Documentation ¶
Index ¶
- Constants
- Variables
- type ConnPGClient
- func (conn *ConnPGClient) BulkDeleteDog(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) BulkInsertDog(ctx context.Context, values []Dog, opts ...pggen.InsertOpt) ([]int64, error)
- func (conn *ConnPGClient) BulkUpsertDog(ctx context.Context, values []Dog, constraintNames []string, ...) (ret []int64, err error)
- func (conn *ConnPGClient) Close() error
- func (conn *ConnPGClient) DeleteDog(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) DogBulkFillIncludes(ctx context.Context, recs []*Dog, includes *include.Spec, ...) error
- func (conn *ConnPGClient) DogFillIncludes(ctx context.Context, rec *Dog, includes *include.Spec, ...) error
- func (conn *ConnPGClient) GetDog(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Dog, error)
- func (conn *ConnPGClient) Handle() pggen.DBHandle
- func (conn *ConnPGClient) InsertDog(ctx context.Context, value *Dog, opts ...pggen.InsertOpt) (ret int64, err error)
- func (conn *ConnPGClient) ListDog(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Dog, err error)
- func (conn *ConnPGClient) UpdateDog(ctx context.Context, value *Dog, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (conn *ConnPGClient) UpsertDog(ctx context.Context, value *Dog, constraintNames []string, ...) (ret int64, err error)
- type DBQueries
- type Dog
- type NullSizeCategory
- type PGClient
- func (p *PGClient) BeginTx(ctx context.Context, opts *sql.TxOptions) (*TxPGClient, error)
- func (p *PGClient) BulkDeleteDog(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) BulkInsertDog(ctx context.Context, values []Dog, opts ...pggen.InsertOpt) ([]int64, error)
- func (p *PGClient) BulkUpsertDog(ctx context.Context, values []Dog, constraintNames []string, ...) (ret []int64, err error)
- func (p *PGClient) Conn(ctx context.Context) (*ConnPGClient, error)
- func (p *PGClient) DeleteDog(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) DogBulkFillIncludes(ctx context.Context, recs []*Dog, includes *include.Spec, ...) error
- func (p *PGClient) DogFillIncludes(ctx context.Context, rec *Dog, includes *include.Spec, ...) error
- func (p *PGClient) GetDog(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Dog, error)
- func (p *PGClient) Handle() pggen.DBHandle
- func (p *PGClient) InsertDog(ctx context.Context, value *Dog, opts ...pggen.InsertOpt) (ret int64, err error)
- func (p *PGClient) ListDog(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Dog, err error)
- func (p *PGClient) UpdateDog(ctx context.Context, value *Dog, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (p *PGClient) UpsertDog(ctx context.Context, value *Dog, constraintNames []string, ...) (ret int64, err error)
- type SizeCategory
- type TxPGClient
- func (tx *TxPGClient) BulkDeleteDog(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) BulkInsertDog(ctx context.Context, values []Dog, opts ...pggen.InsertOpt) ([]int64, error)
- func (tx *TxPGClient) BulkUpsertDog(ctx context.Context, values []Dog, constraintNames []string, ...) (ret []int64, err error)
- func (tx *TxPGClient) Commit() error
- func (tx *TxPGClient) DeleteDog(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) DogBulkFillIncludes(ctx context.Context, recs []*Dog, includes *include.Spec, ...) error
- func (tx *TxPGClient) DogFillIncludes(ctx context.Context, rec *Dog, includes *include.Spec, ...) error
- func (tx *TxPGClient) GetDog(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Dog, error)
- func (tx *TxPGClient) Handle() pggen.DBHandle
- func (tx *TxPGClient) InsertDog(ctx context.Context, value *Dog, opts ...pggen.InsertOpt) (ret int64, err error)
- func (tx *TxPGClient) ListDog(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Dog, err error)
- func (tx *TxPGClient) Rollback() error
- func (tx *TxPGClient) UpdateDog(ctx context.Context, value *Dog, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (tx *TxPGClient) UpsertDog(ctx context.Context, value *Dog, constraintNames []string, ...) (ret int64, err error)
Constants ¶
const ( DogIdFieldIndex int = 0 DogBreedFieldIndex int = 1 DogSizeFieldIndex int = 2 DogAgeInDogYearsFieldIndex int = 3 DogMaxFieldIndex int = (4 - 1) )
bit indicies for 'fieldMask' parameters
Variables ¶
var DogAllFields pggen.FieldSet = pggen.NewFieldSetFilled(4)
A field set saying that all fields in Dog 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) BulkDeleteDog ¶
func (*ConnPGClient) BulkInsertDog ¶
func (conn *ConnPGClient) BulkInsertDog( ctx context.Context, values []Dog, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Dog. Returns a list of the primary keys of the inserted rows.
func (*ConnPGClient) BulkUpsertDog ¶
func (conn *ConnPGClient) BulkUpsertDog( ctx context.Context, values []Dog, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Dog 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) DogBulkFillIncludes ¶
func (conn *ConnPGClient) DogBulkFillIncludes( ctx context.Context, recs []*Dog, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) DogFillIncludes ¶
func (conn *ConnPGClient) DogFillIncludes( ctx context.Context, rec *Dog, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) Handle ¶
func (conn *ConnPGClient) Handle() pggen.DBHandle
func (*ConnPGClient) InsertDog ¶
func (conn *ConnPGClient) InsertDog( ctx context.Context, value *Dog, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Dog into the database. Returns the primary key of the inserted row.
func (*ConnPGClient) UpdateDog ¶
func (conn *ConnPGClient) UpdateDog( ctx context.Context, value *Dog, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Dog. '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) UpsertDog ¶
func (conn *ConnPGClient) UpsertDog( ctx context.Context, value *Dog, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Dog 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 { // Dog methods GetDog(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Dog, error) ListDog(ctx context.Context, ids []int64, opts ...pggen.ListOpt) ([]Dog, error) InsertDog(ctx context.Context, value *Dog, opts ...pggen.InsertOpt) (int64, error) BulkInsertDog(ctx context.Context, values []Dog, opts ...pggen.InsertOpt) ([]int64, error) UpdateDog(ctx context.Context, value *Dog, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt) (ret int64, err error) UpsertDog(ctx context.Context, value *Dog, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) (int64, error) BulkUpsertDog(ctx context.Context, values []Dog, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) ([]int64, error) DeleteDog(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error BulkDeleteDog(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error DogFillIncludes(ctx context.Context, rec *Dog, includes *include.Spec, opts ...pggen.IncludeOpt) error DogBulkFillIncludes(ctx context.Context, recs []*Dog, includes *include.Spec, opts ...pggen.IncludeOpt) error }
type Dog ¶
type Dog struct { Id int64 `gorm:"column:id;is_primary"` Breed string `gorm:"column:breed"` Size SizeCategory `gorm:"column:size"` AgeInDogYears int64 `gorm:"column:age_in_dog_years"` }
type NullSizeCategory ¶
type NullSizeCategory struct { SizeCategory SizeCategory Valid bool }
func (*NullSizeCategory) Scan ¶
func (n *NullSizeCategory) Scan(value interface{}) error
Scan implements the sql.Scanner interface
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) BulkDeleteDog ¶
func (*PGClient) BulkInsertDog ¶
func (p *PGClient) BulkInsertDog( ctx context.Context, values []Dog, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Dog. Returns a list of the primary keys of the inserted rows.
func (*PGClient) BulkUpsertDog ¶
func (p *PGClient) BulkUpsertDog( ctx context.Context, values []Dog, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Dog 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) DogBulkFillIncludes ¶
func (*PGClient) DogFillIncludes ¶
func (*PGClient) InsertDog ¶
func (p *PGClient) InsertDog( ctx context.Context, value *Dog, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Dog into the database. Returns the primary key of the inserted row.
func (*PGClient) UpdateDog ¶
func (p *PGClient) UpdateDog( ctx context.Context, value *Dog, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Dog. '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) UpsertDog ¶
func (p *PGClient) UpsertDog( ctx context.Context, value *Dog, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Dog 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 SizeCategory ¶
type SizeCategory int
const ( SizeCategorySmall SizeCategory = iota SizeCategoryLarge SizeCategory = iota )
func SizeCategoryFromString ¶
func SizeCategoryFromString(s string) (SizeCategory, error)
func (*SizeCategory) Scan ¶
func (s *SizeCategory) Scan(value interface{}) error
func (SizeCategory) String ¶
func (t SizeCategory) String() string
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) BulkDeleteDog ¶
func (*TxPGClient) BulkInsertDog ¶
func (tx *TxPGClient) BulkInsertDog( ctx context.Context, values []Dog, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Dog. Returns a list of the primary keys of the inserted rows.
func (*TxPGClient) BulkUpsertDog ¶
func (tx *TxPGClient) BulkUpsertDog( ctx context.Context, values []Dog, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Dog 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) DogBulkFillIncludes ¶
func (tx *TxPGClient) DogBulkFillIncludes( ctx context.Context, recs []*Dog, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) DogFillIncludes ¶
func (tx *TxPGClient) DogFillIncludes( ctx context.Context, rec *Dog, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) Handle ¶
func (tx *TxPGClient) Handle() pggen.DBHandle
func (*TxPGClient) InsertDog ¶
func (tx *TxPGClient) InsertDog( ctx context.Context, value *Dog, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Dog into the database. Returns the primary key of the inserted row.
func (*TxPGClient) Rollback ¶
func (tx *TxPGClient) Rollback() error
func (*TxPGClient) UpdateDog ¶
func (tx *TxPGClient) UpdateDog( ctx context.Context, value *Dog, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Dog. '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) UpsertDog ¶
func (tx *TxPGClient) UpsertDog( ctx context.Context, value *Dog, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Dog 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.