Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

Notable changes to this fork, newest first. An entry that imports an upstream
pull request names its number and author. Releases up to v1.4.0 are releases of
upstream [jmoiron/sqlx](https://github.com/jmoiron/sqlx).

## Unreleased

- The module path is now `github.com/secondwindoss/sqlx`. The package name
stays `sqlx` and the exported API is unchanged (#2).
- CI runs on GitHub Actions: `go vet`, `staticcheck`, `goimports` and
`govulncheck`, plus the race tests on Go 1.23 to stable against Postgres,
MySQL and SQLite (#1).

## v1.4.0 (2024-04-15, upstream)

The last upstream release; see its
[release notes](https://github.com/jmoiron/sqlx/releases/tag/v1.4.0).
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2013, Jason Moiron
Copyright (c) 2026, the secondwindoss/sqlx contributors

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
42 changes: 34 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# sqlx

[![CircleCI](https://dl.circleci.com/status-badge/img/gh/jmoiron/sqlx/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/jmoiron/sqlx/tree/master) [![Coverage Status](https://coveralls.io/repos/github/jmoiron/sqlx/badge.svg?branch=master)](https://coveralls.io/github/jmoiron/sqlx?branch=master) [![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/jmoiron/sqlx) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/jmoiron/sqlx/master/LICENSE)
[![CI](https://github.com/secondwindoss/sqlx/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/secondwindoss/sqlx/actions/workflows/ci.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/secondwindoss/sqlx.svg)](https://pkg.go.dev/github.com/secondwindoss/sqlx) [![license](https://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/secondwindoss/sqlx/master/LICENSE)

sqlx is a library which provides a set of extensions on go's standard
`database/sql` library. The sqlx versions of `sql.DB`, `sql.TX`, `sql.Stmt`,
Expand All @@ -14,10 +14,36 @@ Major additional concepts are:
* Named parameter support including prepared statements
* `Get` and `Select` to go quickly from query to struct/slice

In addition to the [godoc API documentation](http://godoc.org/github.com/jmoiron/sqlx),
there is also some [user documentation](http://jmoiron.github.io/sqlx/) that
In addition to the [API documentation](https://pkg.go.dev/github.com/secondwindoss/sqlx),
there is also upstream's [user guide](https://jmoiron.github.io/sqlx/) that
explains how to use `database/sql` along with sqlx.

## About this fork

This is a maintained fork of [jmoiron/sqlx](https://github.com/jmoiron/sqlx).
Upstream's last release is v1.4.0 (April 2024); since then bug fixes have sat
unmerged as pull requests with no maintainer activity. The fork keeps the full
upstream history, the MIT license and the `sqlx` package name, and ships those
fixes under the module path `github.com/secondwindoss/sqlx`.

The first fork release, v1.4.1, is a strict superset of upstream v1.4.0: the
same exported API with bug fixes only. [CHANGELOG.md](CHANGELOG.md) lists what
each release contains and which upstream pull request and author each fix
comes from.

## Migrating from github.com/jmoiron/sqlx

Only the import path changes. Rewrite it in your module, then update the
dependency:

grep -rl 'github.com/jmoiron/sqlx' --include='*.go' . | xargs sed -i '' 's#github.com/jmoiron/sqlx#github.com/secondwindoss/sqlx#g'
go get github.com/secondwindoss/sqlx@v1.4.1
go mod tidy

On Linux drop the `''` after `sed -i`. Tags up to v1.4.0 are upstream's and
declare the upstream module path, so v1.4.1 is the first version that resolves
under the new path.

## Recent Changes

1.3.0:
Expand Down Expand Up @@ -46,7 +72,7 @@ will get major version number bumps.

## install

go get github.com/jmoiron/sqlx
go get github.com/secondwindoss/sqlx@v1.4.1

## issues

Expand All @@ -64,7 +90,7 @@ to give columns distinct names, `rows.Scan` to scan them manually, or
## usage

Below is an example which shows some common use cases for sqlx. Check
[sqlx_test.go](https://github.com/jmoiron/sqlx/blob/master/sqlx_test.go) for more
[sqlx_test.go](https://github.com/secondwindoss/sqlx/blob/master/sqlx_test.go) for more
usage.


Expand All @@ -77,7 +103,7 @@ import (
"log"

_ "github.com/lib/pq"
"github.com/jmoiron/sqlx"
"github.com/secondwindoss/sqlx"
)

var schema = `
Expand Down Expand Up @@ -130,9 +156,9 @@ func main() {
// Query the database, storing results in a []Person (wrapped in []interface{})
people := []Person{}
db.Select(&people, "SELECT * FROM person ORDER BY first_name ASC")
jason, john := people[0], people[1]
jason, john := people[1], people[2]

fmt.Printf("%#v\n%#v", jason, john)
fmt.Printf("%#v\n%#v\n", jason, john)
// Person{FirstName:"Jason", LastName:"Moiron", Email:"jmoiron@jmoiron.net"}
// Person{FirstName:"John", LastName:"Doe", Email:"johndoeDNE@gmail.net"}

Expand Down
Loading