Blockloop Scan Versions Save

Tiny lib to scan SQL rows directly to structs, slices, and primitive types

v2.5.0

9 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/blockloop/scan/compare/v2.4.0...v2.5.0

v2.4.0

9 months ago

What's Changed

Full Changelog: https://github.com/blockloop/scan/compare/v2.3.0...v2.4.0

v2.3.0

9 months ago

What's Changed

Full Changelog: https://github.com/blockloop/scan/compare/v2.2.1...v2.3.0

v2.2.1

9 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/blockloop/scan/compare/v2.2.0...v2.2.1

v2.2.0

10 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/blockloop/scan/compare/v2.1.0...v2.2.0

v2.1.0

10 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/blockloop/scan/compare/v2.0.1...v2.1.0

v2.0.1

1 year ago

Fixed an issue where AutoClose didn't close early enough and could have caused a leak

2.0.0

2 years ago

This release adds the ability to scan to a nested struct.

rows, err := db.Query(`
	SELECT person.id,person.name,company.name FROM person
	JOIN company on company.id = person.company_id
	LIMIT 1
`)

var person struct {
	ID      int    `db:"person.id"`
	Name    string `db:"person.name"`
	Company struct {
		Name string `db:"company.name"`
	}
}

err = scan.RowStrict(&person, rows)

err = json.NewEncoder(os.Stdout).Encode(&person)
// Output:
// {"ID":1,"Name":"brett","Company":{"Name":"costco"}}