Skip to content

Commit

Permalink
Improve scany godoc. Add note about pgx version.
Browse files Browse the repository at this point in the history
  • Loading branch information
georgysavva committed Jul 7, 2020
1 parent 781e14e commit ea35e32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
# Scany
# scany

[![GoDoc](https://img.shields.io/badge/pkg.go.dev-doc-blue)](http://pkg.go.dev/github.com/georgysavva/scany)
[![Build Status](https://travis-ci.com/georgysavva/scany.svg?branch=master)](https://travis-ci.com/georgysavva/scany)
[![codecov](https://codecov.io/gh/georgysavva/scany/branch/master/graph/badge.svg)](https://codecov.io/gh/georgysavva/scany)
[![Go Report Card](https://goreportcard.com/badge/github.com/georgysavva/scany)](https://goreportcard.com/report/github.com/georgysavva/scany)

Library for scanning data from a database into Go structs and more.

## Overview

Go favors simplicity, and it's pretty common to work with a database via driver directly without any ORM.
It provides great control and efficiency in your queries, but here is a problem:
you need to manually iterate over database rows and scan data from all columns into a corresponding destination.
It can be error-prone, verbose, and just tedious.
Scany aims to solve this problem,
It can be error-prone verbose and just tedious.
scany aims to solve this problem,
it allows developers to scan complex data from a database into Go structs and other composite types
with just one function call and don't bother with rows iteration.

Scany isn't limited to any specific database. It integrates with standard `database/sql` library,
scany isn't limited to any specific database. It integrates with standard `database/sql` library,
so any database with `database/sql` driver is supported.
It also works with [pgx](https://github.com/jackc/pgx) - specific library for PostgreSQL.
Apart from supporting `database/sql` and `pgx` out of the box,
Scany can be easily extended to work with any database library.
Apart from the out of the box support, scany can be easily extended to work with any database library.

## Install

Expand Down Expand Up @@ -104,7 +101,7 @@ Both `sqlscan` and `pgxscan` use `dbscan` internally.

## Supported Go versions

Scany supports Go 1.13 and higher.
scany supports Go 1.13 and higher.

## Roadmap

Expand Down
7 changes: 6 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Package scany is a set of packages for scanning data from a database into Go structs and more.
/*
scany contains the following packages:
scany isn't limited to any specific database. It integrates with standard `database/sql` library,
so any database with `database/sql` driver is supported.
It also works with https://github.com/jackc/pgx - specific library for PostgreSQL.
Apart from the out of the box support, scany can be easily extended to work with any database library.
It contains the following packages:
sqlscan package works with database/sql standard library.
Expand Down
4 changes: 4 additions & 0 deletions pgxscan/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,9 @@ Note that you must specify pgtype.Text by value, not by a pointer. This will not
This happens because struct fields are always passed to pgx.Rows.Scan() as pointers,
and if the field type is *pgtype.Text, pgx.Rows.Scan() will receive **pgtype.Text and
pgx won't be able to handle that type, since only *pgtype.Text implements pgx custom type interfaces.
Supported pgx version
pgxscan only works with pgx v4. So the import path of your pgx must be: "github.com/jackc/pgx/v4".
*/
package pgxscan

0 comments on commit ea35e32

Please sign in to comment.