Documentation ¶
Index ¶
- Constants
- Variables
- type ConnPGClient
- func (conn *ConnPGClient) BulkDeleteFoo(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) BulkInsertFoo(ctx context.Context, values []Foo, opts ...pggen.InsertOpt) ([]int64, error)
- func (conn *ConnPGClient) BulkUpsertFoo(ctx context.Context, values []Foo, constraintNames []string, ...) (ret []int64, err error)
- func (conn *ConnPGClient) Close() error
- func (conn *ConnPGClient) DeleteFoo(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) FooBulkFillIncludes(ctx context.Context, recs []*Foo, includes *include.Spec, ...) error
- func (conn *ConnPGClient) FooFillIncludes(ctx context.Context, rec *Foo, includes *include.Spec, ...) error
- func (conn *ConnPGClient) GetFoo(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Foo, error)
- func (conn *ConnPGClient) Handle() pggen.DBHandle
- func (conn *ConnPGClient) InsertFoo(ctx context.Context, value *Foo, opts ...pggen.InsertOpt) (ret int64, err error)
- func (conn *ConnPGClient) ListFoo(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Foo, err error)
- func (conn *ConnPGClient) MyGetFooValue(ctx context.Context, arg1 int64) (ret *string, err error)
- func (conn *ConnPGClient) UpdateFoo(ctx context.Context, value *Foo, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (conn *ConnPGClient) UpsertFoo(ctx context.Context, value *Foo, constraintNames []string, ...) (ret int64, err error)
- type DBQueries
- type Foo
- type PGClient
- func (p *PGClient) BeginTx(ctx context.Context, opts *sql.TxOptions) (*TxPGClient, error)
- func (p *PGClient) BulkDeleteFoo(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) BulkInsertFoo(ctx context.Context, values []Foo, opts ...pggen.InsertOpt) ([]int64, error)
- func (p *PGClient) BulkUpsertFoo(ctx context.Context, values []Foo, constraintNames []string, ...) (ret []int64, err error)
- func (p *PGClient) Conn(ctx context.Context) (*ConnPGClient, error)
- func (p *PGClient) DeleteFoo(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) FooBulkFillIncludes(ctx context.Context, recs []*Foo, includes *include.Spec, ...) error
- func (p *PGClient) FooFillIncludes(ctx context.Context, rec *Foo, includes *include.Spec, ...) error
- func (p *PGClient) GetFoo(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Foo, error)
- func (p *PGClient) Handle() pggen.DBHandle
- func (p *PGClient) InsertFoo(ctx context.Context, value *Foo, opts ...pggen.InsertOpt) (ret int64, err error)
- func (p *PGClient) ListFoo(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Foo, err error)
- func (p *PGClient) MyGetFooValue(ctx context.Context, arg1 int64) (ret *string, err error)
- func (p *PGClient) UpdateFoo(ctx context.Context, value *Foo, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (p *PGClient) UpsertFoo(ctx context.Context, value *Foo, constraintNames []string, ...) (ret int64, err error)
- type TxPGClient
- func (tx *TxPGClient) BulkDeleteFoo(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) BulkInsertFoo(ctx context.Context, values []Foo, opts ...pggen.InsertOpt) ([]int64, error)
- func (tx *TxPGClient) BulkUpsertFoo(ctx context.Context, values []Foo, constraintNames []string, ...) (ret []int64, err error)
- func (tx *TxPGClient) Commit() error
- func (tx *TxPGClient) DeleteFoo(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) FooBulkFillIncludes(ctx context.Context, recs []*Foo, includes *include.Spec, ...) error
- func (tx *TxPGClient) FooFillIncludes(ctx context.Context, rec *Foo, includes *include.Spec, ...) error
- func (tx *TxPGClient) GetFoo(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Foo, error)
- func (tx *TxPGClient) Handle() pggen.DBHandle
- func (tx *TxPGClient) InsertFoo(ctx context.Context, value *Foo, opts ...pggen.InsertOpt) (ret int64, err error)
- func (tx *TxPGClient) ListFoo(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Foo, err error)
- func (tx *TxPGClient) MyGetFooValue(ctx context.Context, arg1 int64) (ret *string, err error)
- func (tx *TxPGClient) Rollback() error
- func (tx *TxPGClient) UpdateFoo(ctx context.Context, value *Foo, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (tx *TxPGClient) UpsertFoo(ctx context.Context, value *Foo, constraintNames []string, ...) (ret int64, err error)
Constants ¶
const ( FooIdFieldIndex int = 0 FooValueFieldIndex int = 1 FooMaxFieldIndex int = (2 - 1) )
bit indicies for 'fieldMask' parameters
Variables ¶
var FooAllFields pggen.FieldSet = pggen.NewFieldSetFilled(2)
A field set saying that all fields in Foo should be updated. For use as a 'fieldMask' parameter
Functions ¶
This section is empty.
Types ¶
type ConnPGClient ¶
type ConnPGClient struct {
// contains filtered or unexported fields
}
func (*ConnPGClient) BulkDeleteFoo ¶
func (*ConnPGClient) BulkInsertFoo ¶
func (conn *ConnPGClient) BulkInsertFoo( ctx context.Context, values []Foo, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Foo. Returns a list of the primary keys of the inserted rows.
func (*ConnPGClient) BulkUpsertFoo ¶
func (conn *ConnPGClient) BulkUpsertFoo( ctx context.Context, values []Foo, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Foo values. If any of the given values conflict with existing rows in the database, use the provided values to update the rows which exist in the database rather than inserting them. Only the fields specified by 'fieldMask' are actually updated. All other fields are left as-is.
func (*ConnPGClient) Close ¶
func (conn *ConnPGClient) Close() error
func (*ConnPGClient) FooBulkFillIncludes ¶
func (conn *ConnPGClient) FooBulkFillIncludes( ctx context.Context, recs []*Foo, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) FooFillIncludes ¶
func (conn *ConnPGClient) FooFillIncludes( ctx context.Context, rec *Foo, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) Handle ¶
func (conn *ConnPGClient) Handle() pggen.DBHandle
func (*ConnPGClient) InsertFoo ¶
func (conn *ConnPGClient) InsertFoo( ctx context.Context, value *Foo, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Foo into the database. Returns the primary key of the inserted row.
func (*ConnPGClient) MyGetFooValue ¶
func (*ConnPGClient) UpdateFoo ¶
func (conn *ConnPGClient) UpdateFoo( ctx context.Context, value *Foo, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Foo. 'value' must at the least have a primary key set. The 'fieldMask' field set indicates which fields should be updated in the database.
Returns the primary key of the updated row.
func (*ConnPGClient) UpsertFoo ¶
func (conn *ConnPGClient) UpsertFoo( ctx context.Context, value *Foo, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Foo value. If the given value conflicts with an existing row in the database, use the provided value to update that row rather than inserting it. Only the fields specified by 'fieldMask' are actually updated. All other fields are left as-is.
type DBQueries ¶
type DBQueries interface { // Foo methods GetFoo(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Foo, error) ListFoo(ctx context.Context, ids []int64, opts ...pggen.ListOpt) ([]Foo, error) InsertFoo(ctx context.Context, value *Foo, opts ...pggen.InsertOpt) (int64, error) BulkInsertFoo(ctx context.Context, values []Foo, opts ...pggen.InsertOpt) ([]int64, error) UpdateFoo(ctx context.Context, value *Foo, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt) (ret int64, err error) UpsertFoo(ctx context.Context, value *Foo, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) (int64, error) BulkUpsertFoo(ctx context.Context, values []Foo, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) ([]int64, error) DeleteFoo(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error BulkDeleteFoo(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error FooFillIncludes(ctx context.Context, rec *Foo, includes *include.Spec, opts ...pggen.IncludeOpt) error FooBulkFillIncludes(ctx context.Context, recs []*Foo, includes *include.Spec, opts ...pggen.IncludeOpt) error // MyGetFooValue query MyGetFooValue( ctx context.Context, arg1 int64, ) (*string, error) }
type PGClient ¶
type PGClient struct {
// contains filtered or unexported fields
}
PGClient wraps either a 'sql.DB' or a 'sql.Tx'. All pggen-generated database access methods for this package are attached to it.
func NewPGClient ¶
NewPGClient creates a new PGClient out of a '*sql.DB' or a custom wrapper around a db connection.
If you provide your own wrapper around a '*sql.DB' for logging or custom tracing, you MUST forward all calls to an underlying '*sql.DB' member of your wrapper.
If the DBConn passed into NewPGClient implements an ErrorConverter method which returns a func(error) error, the result of calling the ErrorConverter method will be called on every error that the generated code returns right before the error is returned. If ErrorConverter returns nil or is not present, it will default to the identity function.
func (*PGClient) BulkDeleteFoo ¶
func (*PGClient) BulkInsertFoo ¶
func (p *PGClient) BulkInsertFoo( ctx context.Context, values []Foo, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Foo. Returns a list of the primary keys of the inserted rows.
func (*PGClient) BulkUpsertFoo ¶
func (p *PGClient) BulkUpsertFoo( ctx context.Context, values []Foo, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Foo values. If any of the given values conflict with existing rows in the database, use the provided values to update the rows which exist in the database rather than inserting them. Only the fields specified by 'fieldMask' are actually updated. All other fields are left as-is.
func (*PGClient) FooBulkFillIncludes ¶
func (*PGClient) FooFillIncludes ¶
func (*PGClient) InsertFoo ¶
func (p *PGClient) InsertFoo( ctx context.Context, value *Foo, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Foo into the database. Returns the primary key of the inserted row.
func (*PGClient) MyGetFooValue ¶
func (*PGClient) UpdateFoo ¶
func (p *PGClient) UpdateFoo( ctx context.Context, value *Foo, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Foo. 'value' must at the least have a primary key set. The 'fieldMask' field set indicates which fields should be updated in the database.
Returns the primary key of the updated row.
func (*PGClient) UpsertFoo ¶
func (p *PGClient) UpsertFoo( ctx context.Context, value *Foo, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Foo value. If the given value conflicts with an existing row in the database, use the provided value to update that row rather than inserting it. Only the fields specified by 'fieldMask' are actually updated. All other fields are left as-is.
type TxPGClient ¶
type TxPGClient struct {
// contains filtered or unexported fields
}
A postgres client that operates within a transaction. Supports all the same generated methods that PGClient does.
func (*TxPGClient) BulkDeleteFoo ¶
func (*TxPGClient) BulkInsertFoo ¶
func (tx *TxPGClient) BulkInsertFoo( ctx context.Context, values []Foo, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Foo. Returns a list of the primary keys of the inserted rows.
func (*TxPGClient) BulkUpsertFoo ¶
func (tx *TxPGClient) BulkUpsertFoo( ctx context.Context, values []Foo, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Foo values. If any of the given values conflict with existing rows in the database, use the provided values to update the rows which exist in the database rather than inserting them. Only the fields specified by 'fieldMask' are actually updated. All other fields are left as-is.
func (*TxPGClient) Commit ¶
func (tx *TxPGClient) Commit() error
func (*TxPGClient) FooBulkFillIncludes ¶
func (tx *TxPGClient) FooBulkFillIncludes( ctx context.Context, recs []*Foo, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) FooFillIncludes ¶
func (tx *TxPGClient) FooFillIncludes( ctx context.Context, rec *Foo, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) Handle ¶
func (tx *TxPGClient) Handle() pggen.DBHandle
func (*TxPGClient) InsertFoo ¶
func (tx *TxPGClient) InsertFoo( ctx context.Context, value *Foo, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Foo into the database. Returns the primary key of the inserted row.
func (*TxPGClient) MyGetFooValue ¶
func (*TxPGClient) Rollback ¶
func (tx *TxPGClient) Rollback() error
func (*TxPGClient) UpdateFoo ¶
func (tx *TxPGClient) UpdateFoo( ctx context.Context, value *Foo, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Foo. 'value' must at the least have a primary key set. The 'fieldMask' field set indicates which fields should be updated in the database.
Returns the primary key of the updated row.
func (*TxPGClient) UpsertFoo ¶
func (tx *TxPGClient) UpsertFoo( ctx context.Context, value *Foo, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Foo value. If the given value conflicts with an existing row in the database, use the provided value to update that row rather than inserting it. Only the fields specified by 'fieldMask' are actually updated. All other fields are left as-is.