Documentation ¶
Index ¶
- Constants
- Variables
- type Child
- type ConnPGClient
- func (conn *ConnPGClient) BulkDeleteChild(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) BulkDeleteGrandparent(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) BulkDeleteParent(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) BulkInsertChild(ctx context.Context, values []Child, opts ...pggen.InsertOpt) ([]int64, error)
- func (conn *ConnPGClient) BulkInsertGrandparent(ctx context.Context, values []Grandparent, opts ...pggen.InsertOpt) ([]int64, error)
- func (conn *ConnPGClient) BulkInsertParent(ctx context.Context, values []Parent, opts ...pggen.InsertOpt) ([]int64, error)
- func (conn *ConnPGClient) BulkUpsertChild(ctx context.Context, values []Child, constraintNames []string, ...) (ret []int64, err error)
- func (conn *ConnPGClient) BulkUpsertGrandparent(ctx context.Context, values []Grandparent, constraintNames []string, ...) (ret []int64, err error)
- func (conn *ConnPGClient) BulkUpsertParent(ctx context.Context, values []Parent, constraintNames []string, ...) (ret []int64, err error)
- func (conn *ConnPGClient) ChildBulkFillIncludes(ctx context.Context, recs []*Child, includes *include.Spec, ...) error
- func (conn *ConnPGClient) ChildFillIncludes(ctx context.Context, rec *Child, includes *include.Spec, ...) error
- func (conn *ConnPGClient) Close() error
- func (conn *ConnPGClient) DeleteChild(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) DeleteGrandparent(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) DeleteParent(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) GetChild(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Child, error)
- func (conn *ConnPGClient) GetGrandparent(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Grandparent, error)
- func (conn *ConnPGClient) GetParent(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Parent, error)
- func (conn *ConnPGClient) GrandparentBulkFillIncludes(ctx context.Context, recs []*Grandparent, includes *include.Spec, ...) error
- func (conn *ConnPGClient) GrandparentFillIncludes(ctx context.Context, rec *Grandparent, includes *include.Spec, ...) error
- func (conn *ConnPGClient) Handle() pggen.DBHandle
- func (conn *ConnPGClient) InsertChild(ctx context.Context, value *Child, opts ...pggen.InsertOpt) (ret int64, err error)
- func (conn *ConnPGClient) InsertGrandparent(ctx context.Context, value *Grandparent, opts ...pggen.InsertOpt) (ret int64, err error)
- func (conn *ConnPGClient) InsertParent(ctx context.Context, value *Parent, opts ...pggen.InsertOpt) (ret int64, err error)
- func (conn *ConnPGClient) ListChild(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Child, err error)
- func (conn *ConnPGClient) ListGrandparent(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Grandparent, err error)
- func (conn *ConnPGClient) ListParent(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Parent, err error)
- func (conn *ConnPGClient) ParentBulkFillIncludes(ctx context.Context, recs []*Parent, includes *include.Spec, ...) error
- func (conn *ConnPGClient) ParentFillIncludes(ctx context.Context, rec *Parent, includes *include.Spec, ...) error
- func (conn *ConnPGClient) UpdateChild(ctx context.Context, value *Child, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (conn *ConnPGClient) UpdateGrandparent(ctx context.Context, value *Grandparent, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (conn *ConnPGClient) UpdateParent(ctx context.Context, value *Parent, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (conn *ConnPGClient) UpsertChild(ctx context.Context, value *Child, constraintNames []string, ...) (ret int64, err error)
- func (conn *ConnPGClient) UpsertGrandparent(ctx context.Context, value *Grandparent, constraintNames []string, ...) (ret int64, err error)
- func (conn *ConnPGClient) UpsertParent(ctx context.Context, value *Parent, constraintNames []string, ...) (ret int64, err error)
- type DBQueries
- type Grandparent
- type PGClient
- func (p *PGClient) BeginTx(ctx context.Context, opts *sql.TxOptions) (*TxPGClient, error)
- func (p *PGClient) BulkDeleteChild(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) BulkDeleteGrandparent(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) BulkDeleteParent(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) BulkInsertChild(ctx context.Context, values []Child, opts ...pggen.InsertOpt) ([]int64, error)
- func (p *PGClient) BulkInsertGrandparent(ctx context.Context, values []Grandparent, opts ...pggen.InsertOpt) ([]int64, error)
- func (p *PGClient) BulkInsertParent(ctx context.Context, values []Parent, opts ...pggen.InsertOpt) ([]int64, error)
- func (p *PGClient) BulkUpsertChild(ctx context.Context, values []Child, constraintNames []string, ...) (ret []int64, err error)
- func (p *PGClient) BulkUpsertGrandparent(ctx context.Context, values []Grandparent, constraintNames []string, ...) (ret []int64, err error)
- func (p *PGClient) BulkUpsertParent(ctx context.Context, values []Parent, constraintNames []string, ...) (ret []int64, err error)
- func (p *PGClient) ChildBulkFillIncludes(ctx context.Context, recs []*Child, includes *include.Spec, ...) error
- func (p *PGClient) ChildFillIncludes(ctx context.Context, rec *Child, includes *include.Spec, ...) error
- func (p *PGClient) Conn(ctx context.Context) (*ConnPGClient, error)
- func (p *PGClient) DeleteChild(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) DeleteGrandparent(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) DeleteParent(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) GetChild(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Child, error)
- func (p *PGClient) GetGrandparent(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Grandparent, error)
- func (p *PGClient) GetParent(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Parent, error)
- func (p *PGClient) GrandparentBulkFillIncludes(ctx context.Context, recs []*Grandparent, includes *include.Spec, ...) error
- func (p *PGClient) GrandparentFillIncludes(ctx context.Context, rec *Grandparent, includes *include.Spec, ...) error
- func (p *PGClient) Handle() pggen.DBHandle
- func (p *PGClient) InsertChild(ctx context.Context, value *Child, opts ...pggen.InsertOpt) (ret int64, err error)
- func (p *PGClient) InsertGrandparent(ctx context.Context, value *Grandparent, opts ...pggen.InsertOpt) (ret int64, err error)
- func (p *PGClient) InsertParent(ctx context.Context, value *Parent, opts ...pggen.InsertOpt) (ret int64, err error)
- func (p *PGClient) ListChild(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Child, err error)
- func (p *PGClient) ListGrandparent(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Grandparent, err error)
- func (p *PGClient) ListParent(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Parent, err error)
- func (p *PGClient) ParentBulkFillIncludes(ctx context.Context, recs []*Parent, includes *include.Spec, ...) error
- func (p *PGClient) ParentFillIncludes(ctx context.Context, rec *Parent, includes *include.Spec, ...) error
- func (p *PGClient) UpdateChild(ctx context.Context, value *Child, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (p *PGClient) UpdateGrandparent(ctx context.Context, value *Grandparent, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (p *PGClient) UpdateParent(ctx context.Context, value *Parent, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (p *PGClient) UpsertChild(ctx context.Context, value *Child, constraintNames []string, ...) (ret int64, err error)
- func (p *PGClient) UpsertGrandparent(ctx context.Context, value *Grandparent, constraintNames []string, ...) (ret int64, err error)
- func (p *PGClient) UpsertParent(ctx context.Context, value *Parent, constraintNames []string, ...) (ret int64, err error)
- type Parent
- type TxPGClient
- func (tx *TxPGClient) BulkDeleteChild(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) BulkDeleteGrandparent(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) BulkDeleteParent(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) BulkInsertChild(ctx context.Context, values []Child, opts ...pggen.InsertOpt) ([]int64, error)
- func (tx *TxPGClient) BulkInsertGrandparent(ctx context.Context, values []Grandparent, opts ...pggen.InsertOpt) ([]int64, error)
- func (tx *TxPGClient) BulkInsertParent(ctx context.Context, values []Parent, opts ...pggen.InsertOpt) ([]int64, error)
- func (tx *TxPGClient) BulkUpsertChild(ctx context.Context, values []Child, constraintNames []string, ...) (ret []int64, err error)
- func (tx *TxPGClient) BulkUpsertGrandparent(ctx context.Context, values []Grandparent, constraintNames []string, ...) (ret []int64, err error)
- func (tx *TxPGClient) BulkUpsertParent(ctx context.Context, values []Parent, constraintNames []string, ...) (ret []int64, err error)
- func (tx *TxPGClient) ChildBulkFillIncludes(ctx context.Context, recs []*Child, includes *include.Spec, ...) error
- func (tx *TxPGClient) ChildFillIncludes(ctx context.Context, rec *Child, includes *include.Spec, ...) error
- func (tx *TxPGClient) Commit() error
- func (tx *TxPGClient) DeleteChild(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) DeleteGrandparent(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) DeleteParent(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) GetChild(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Child, error)
- func (tx *TxPGClient) GetGrandparent(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Grandparent, error)
- func (tx *TxPGClient) GetParent(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Parent, error)
- func (tx *TxPGClient) GrandparentBulkFillIncludes(ctx context.Context, recs []*Grandparent, includes *include.Spec, ...) error
- func (tx *TxPGClient) GrandparentFillIncludes(ctx context.Context, rec *Grandparent, includes *include.Spec, ...) error
- func (tx *TxPGClient) Handle() pggen.DBHandle
- func (tx *TxPGClient) InsertChild(ctx context.Context, value *Child, opts ...pggen.InsertOpt) (ret int64, err error)
- func (tx *TxPGClient) InsertGrandparent(ctx context.Context, value *Grandparent, opts ...pggen.InsertOpt) (ret int64, err error)
- func (tx *TxPGClient) InsertParent(ctx context.Context, value *Parent, opts ...pggen.InsertOpt) (ret int64, err error)
- func (tx *TxPGClient) ListChild(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Child, err error)
- func (tx *TxPGClient) ListGrandparent(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Grandparent, err error)
- func (tx *TxPGClient) ListParent(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []Parent, err error)
- func (tx *TxPGClient) ParentBulkFillIncludes(ctx context.Context, recs []*Parent, includes *include.Spec, ...) error
- func (tx *TxPGClient) ParentFillIncludes(ctx context.Context, rec *Parent, includes *include.Spec, ...) error
- func (tx *TxPGClient) Rollback() error
- func (tx *TxPGClient) UpdateChild(ctx context.Context, value *Child, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (tx *TxPGClient) UpdateGrandparent(ctx context.Context, value *Grandparent, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (tx *TxPGClient) UpdateParent(ctx context.Context, value *Parent, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (tx *TxPGClient) UpsertChild(ctx context.Context, value *Child, constraintNames []string, ...) (ret int64, err error)
- func (tx *TxPGClient) UpsertGrandparent(ctx context.Context, value *Grandparent, constraintNames []string, ...) (ret int64, err error)
- func (tx *TxPGClient) UpsertParent(ctx context.Context, value *Parent, constraintNames []string, ...) (ret int64, err error)
Constants ¶
const ( GrandparentIdFieldIndex int = 0 GrandparentNameFieldIndex int = 1 GrandparentFavoriteGrandkidIdFieldIndex int = 2 GrandparentMaxFieldIndex int = (3 - 1) )
bit indicies for 'fieldMask' parameters
const ( ParentIdFieldIndex int = 0 ParentGrandparentIdFieldIndex int = 1 ParentNameFieldIndex int = 2 ParentMaxFieldIndex int = (3 - 1) )
bit indicies for 'fieldMask' parameters
const ( ChildIdFieldIndex int = 0 ChildParentIdFieldIndex int = 1 ChildNameFieldIndex int = 2 ChildMaxFieldIndex int = (3 - 1) )
bit indicies for 'fieldMask' parameters
Variables ¶
var ChildAllFields pggen.FieldSet = pggen.NewFieldSetFilled(3)
A field set saying that all fields in Child should be updated. For use as a 'fieldMask' parameter
var ChildAllIncludes *include.Spec = include.Must(include.Parse(
`children.{darling_grandparents->grandparents.{favorite_grandkid->children,parents.{children,grandparents}},parents}`,
))
var GrandparentAllFields pggen.FieldSet = pggen.NewFieldSetFilled(3)
A field set saying that all fields in Grandparent should be updated. For use as a 'fieldMask' parameter
var GrandparentAllIncludes *include.Spec = include.Must(include.Parse(
`grandparents.{favorite_grandkid->children.{darling_grandparents->grandparents,parents.{children,grandparents}},parents}`,
))
var ParentAllFields pggen.FieldSet = pggen.NewFieldSetFilled(3)
A field set saying that all fields in Parent should be updated. For use as a 'fieldMask' parameter
Functions ¶
This section is empty.
Types ¶
type Child ¶
type Child struct { Id int64 `gorm:"column:id;is_primary"` ParentId int64 `gorm:"column:parent_id"` Name string `gorm:"column:name"` DarlingGrandparents []*Grandparent `gorm:"foreignKey:FavoriteGrandkidId"` Parent *Parent }
type ConnPGClient ¶
type ConnPGClient struct {
// contains filtered or unexported fields
}
func (*ConnPGClient) BulkDeleteChild ¶
func (*ConnPGClient) BulkDeleteGrandparent ¶
func (*ConnPGClient) BulkDeleteParent ¶
func (*ConnPGClient) BulkInsertChild ¶
func (conn *ConnPGClient) BulkInsertChild( ctx context.Context, values []Child, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Child. Returns a list of the primary keys of the inserted rows.
func (*ConnPGClient) BulkInsertGrandparent ¶
func (conn *ConnPGClient) BulkInsertGrandparent( ctx context.Context, values []Grandparent, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Grandparent. Returns a list of the primary keys of the inserted rows.
func (*ConnPGClient) BulkInsertParent ¶
func (conn *ConnPGClient) BulkInsertParent( ctx context.Context, values []Parent, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Parent. Returns a list of the primary keys of the inserted rows.
func (*ConnPGClient) BulkUpsertChild ¶
func (conn *ConnPGClient) BulkUpsertChild( ctx context.Context, values []Child, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Child 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) BulkUpsertGrandparent ¶
func (conn *ConnPGClient) BulkUpsertGrandparent( ctx context.Context, values []Grandparent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Grandparent 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) BulkUpsertParent ¶
func (conn *ConnPGClient) BulkUpsertParent( ctx context.Context, values []Parent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Parent 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) ChildBulkFillIncludes ¶
func (conn *ConnPGClient) ChildBulkFillIncludes( ctx context.Context, recs []*Child, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) ChildFillIncludes ¶
func (conn *ConnPGClient) ChildFillIncludes( ctx context.Context, rec *Child, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) Close ¶
func (conn *ConnPGClient) Close() error
func (*ConnPGClient) DeleteChild ¶
func (*ConnPGClient) DeleteGrandparent ¶
func (*ConnPGClient) DeleteParent ¶
func (*ConnPGClient) GetGrandparent ¶
func (conn *ConnPGClient) GetGrandparent( ctx context.Context, id int64, opts ...pggen.GetOpt, ) (*Grandparent, error)
func (*ConnPGClient) GrandparentBulkFillIncludes ¶
func (conn *ConnPGClient) GrandparentBulkFillIncludes( ctx context.Context, recs []*Grandparent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) GrandparentFillIncludes ¶
func (conn *ConnPGClient) GrandparentFillIncludes( ctx context.Context, rec *Grandparent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) Handle ¶
func (conn *ConnPGClient) Handle() pggen.DBHandle
func (*ConnPGClient) InsertChild ¶
func (conn *ConnPGClient) InsertChild( ctx context.Context, value *Child, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Child into the database. Returns the primary key of the inserted row.
func (*ConnPGClient) InsertGrandparent ¶
func (conn *ConnPGClient) InsertGrandparent( ctx context.Context, value *Grandparent, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Grandparent into the database. Returns the primary key of the inserted row.
func (*ConnPGClient) InsertParent ¶
func (conn *ConnPGClient) InsertParent( ctx context.Context, value *Parent, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Parent into the database. Returns the primary key of the inserted row.
func (*ConnPGClient) ListGrandparent ¶
func (conn *ConnPGClient) ListGrandparent( ctx context.Context, ids []int64, opts ...pggen.ListOpt, ) (ret []Grandparent, err error)
func (*ConnPGClient) ListParent ¶
func (*ConnPGClient) ParentBulkFillIncludes ¶
func (conn *ConnPGClient) ParentBulkFillIncludes( ctx context.Context, recs []*Parent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) ParentFillIncludes ¶
func (conn *ConnPGClient) ParentFillIncludes( ctx context.Context, rec *Parent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) UpdateChild ¶
func (conn *ConnPGClient) UpdateChild( ctx context.Context, value *Child, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Child. '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) UpdateGrandparent ¶
func (conn *ConnPGClient) UpdateGrandparent( ctx context.Context, value *Grandparent, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Grandparent. '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) UpdateParent ¶
func (conn *ConnPGClient) UpdateParent( ctx context.Context, value *Parent, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Parent. '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) UpsertChild ¶
func (conn *ConnPGClient) UpsertChild( ctx context.Context, value *Child, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Child 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.
func (*ConnPGClient) UpsertGrandparent ¶
func (conn *ConnPGClient) UpsertGrandparent( ctx context.Context, value *Grandparent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Grandparent 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.
func (*ConnPGClient) UpsertParent ¶
func (conn *ConnPGClient) UpsertParent( ctx context.Context, value *Parent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Parent 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 { // Grandparent methods GetGrandparent(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Grandparent, error) ListGrandparent(ctx context.Context, ids []int64, opts ...pggen.ListOpt) ([]Grandparent, error) InsertGrandparent(ctx context.Context, value *Grandparent, opts ...pggen.InsertOpt) (int64, error) BulkInsertGrandparent(ctx context.Context, values []Grandparent, opts ...pggen.InsertOpt) ([]int64, error) UpdateGrandparent(ctx context.Context, value *Grandparent, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt) (ret int64, err error) UpsertGrandparent(ctx context.Context, value *Grandparent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) (int64, error) BulkUpsertGrandparent(ctx context.Context, values []Grandparent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) ([]int64, error) DeleteGrandparent(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error BulkDeleteGrandparent(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error GrandparentFillIncludes(ctx context.Context, rec *Grandparent, includes *include.Spec, opts ...pggen.IncludeOpt) error GrandparentBulkFillIncludes(ctx context.Context, recs []*Grandparent, includes *include.Spec, opts ...pggen.IncludeOpt) error // Parent methods GetParent(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Parent, error) ListParent(ctx context.Context, ids []int64, opts ...pggen.ListOpt) ([]Parent, error) InsertParent(ctx context.Context, value *Parent, opts ...pggen.InsertOpt) (int64, error) BulkInsertParent(ctx context.Context, values []Parent, opts ...pggen.InsertOpt) ([]int64, error) UpdateParent(ctx context.Context, value *Parent, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt) (ret int64, err error) UpsertParent(ctx context.Context, value *Parent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) (int64, error) BulkUpsertParent(ctx context.Context, values []Parent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) ([]int64, error) DeleteParent(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error BulkDeleteParent(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error ParentFillIncludes(ctx context.Context, rec *Parent, includes *include.Spec, opts ...pggen.IncludeOpt) error ParentBulkFillIncludes(ctx context.Context, recs []*Parent, includes *include.Spec, opts ...pggen.IncludeOpt) error // Child methods GetChild(ctx context.Context, id int64, opts ...pggen.GetOpt) (*Child, error) ListChild(ctx context.Context, ids []int64, opts ...pggen.ListOpt) ([]Child, error) InsertChild(ctx context.Context, value *Child, opts ...pggen.InsertOpt) (int64, error) BulkInsertChild(ctx context.Context, values []Child, opts ...pggen.InsertOpt) ([]int64, error) UpdateChild(ctx context.Context, value *Child, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt) (ret int64, err error) UpsertChild(ctx context.Context, value *Child, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) (int64, error) BulkUpsertChild(ctx context.Context, values []Child, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) ([]int64, error) DeleteChild(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error BulkDeleteChild(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error ChildFillIncludes(ctx context.Context, rec *Child, includes *include.Spec, opts ...pggen.IncludeOpt) error ChildBulkFillIncludes(ctx context.Context, recs []*Child, includes *include.Spec, opts ...pggen.IncludeOpt) error }
type Grandparent ¶
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) BulkDeleteChild ¶
func (*PGClient) BulkDeleteGrandparent ¶
func (*PGClient) BulkDeleteParent ¶
func (*PGClient) BulkInsertChild ¶
func (p *PGClient) BulkInsertChild( ctx context.Context, values []Child, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Child. Returns a list of the primary keys of the inserted rows.
func (*PGClient) BulkInsertGrandparent ¶
func (p *PGClient) BulkInsertGrandparent( ctx context.Context, values []Grandparent, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Grandparent. Returns a list of the primary keys of the inserted rows.
func (*PGClient) BulkInsertParent ¶
func (p *PGClient) BulkInsertParent( ctx context.Context, values []Parent, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Parent. Returns a list of the primary keys of the inserted rows.
func (*PGClient) BulkUpsertChild ¶
func (p *PGClient) BulkUpsertChild( ctx context.Context, values []Child, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Child 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) BulkUpsertGrandparent ¶
func (p *PGClient) BulkUpsertGrandparent( ctx context.Context, values []Grandparent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Grandparent 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) BulkUpsertParent ¶
func (p *PGClient) BulkUpsertParent( ctx context.Context, values []Parent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Parent 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) ChildBulkFillIncludes ¶
func (*PGClient) ChildFillIncludes ¶
func (*PGClient) DeleteChild ¶
func (*PGClient) DeleteGrandparent ¶
func (*PGClient) DeleteParent ¶
func (*PGClient) GetGrandparent ¶
func (*PGClient) GrandparentBulkFillIncludes ¶
func (p *PGClient) GrandparentBulkFillIncludes( ctx context.Context, recs []*Grandparent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*PGClient) GrandparentFillIncludes ¶
func (p *PGClient) GrandparentFillIncludes( ctx context.Context, rec *Grandparent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*PGClient) InsertChild ¶
func (p *PGClient) InsertChild( ctx context.Context, value *Child, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Child into the database. Returns the primary key of the inserted row.
func (*PGClient) InsertGrandparent ¶
func (p *PGClient) InsertGrandparent( ctx context.Context, value *Grandparent, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Grandparent into the database. Returns the primary key of the inserted row.
func (*PGClient) InsertParent ¶
func (p *PGClient) InsertParent( ctx context.Context, value *Parent, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Parent into the database. Returns the primary key of the inserted row.
func (*PGClient) ListGrandparent ¶
func (*PGClient) ListParent ¶
func (*PGClient) ParentBulkFillIncludes ¶
func (*PGClient) ParentFillIncludes ¶
func (*PGClient) UpdateChild ¶
func (p *PGClient) UpdateChild( ctx context.Context, value *Child, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Child. '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) UpdateGrandparent ¶
func (p *PGClient) UpdateGrandparent( ctx context.Context, value *Grandparent, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Grandparent. '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) UpdateParent ¶
func (p *PGClient) UpdateParent( ctx context.Context, value *Parent, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Parent. '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) UpsertChild ¶
func (p *PGClient) UpsertChild( ctx context.Context, value *Child, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Child 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.
func (*PGClient) UpsertGrandparent ¶
func (p *PGClient) UpsertGrandparent( ctx context.Context, value *Grandparent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Grandparent 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.
func (*PGClient) UpsertParent ¶
func (p *PGClient) UpsertParent( ctx context.Context, value *Parent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Parent 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 Parent ¶
type Parent struct { Id int64 `gorm:"column:id;is_primary"` GrandparentId int64 `gorm:"column:grandparent_id"` Name string `gorm:"column:name"` Children []*Child `gorm:"foreignKey:ParentId"` Grandparent *Grandparent }
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) BulkDeleteChild ¶
func (*TxPGClient) BulkDeleteGrandparent ¶
func (*TxPGClient) BulkDeleteParent ¶
func (*TxPGClient) BulkInsertChild ¶
func (tx *TxPGClient) BulkInsertChild( ctx context.Context, values []Child, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Child. Returns a list of the primary keys of the inserted rows.
func (*TxPGClient) BulkInsertGrandparent ¶
func (tx *TxPGClient) BulkInsertGrandparent( ctx context.Context, values []Grandparent, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Grandparent. Returns a list of the primary keys of the inserted rows.
func (*TxPGClient) BulkInsertParent ¶
func (tx *TxPGClient) BulkInsertParent( ctx context.Context, values []Parent, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of Parent. Returns a list of the primary keys of the inserted rows.
func (*TxPGClient) BulkUpsertChild ¶
func (tx *TxPGClient) BulkUpsertChild( ctx context.Context, values []Child, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Child 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) BulkUpsertGrandparent ¶
func (tx *TxPGClient) BulkUpsertGrandparent( ctx context.Context, values []Grandparent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Grandparent 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) BulkUpsertParent ¶
func (tx *TxPGClient) BulkUpsertParent( ctx context.Context, values []Parent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of Parent 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) ChildBulkFillIncludes ¶
func (tx *TxPGClient) ChildBulkFillIncludes( ctx context.Context, recs []*Child, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) ChildFillIncludes ¶
func (tx *TxPGClient) ChildFillIncludes( ctx context.Context, rec *Child, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) Commit ¶
func (tx *TxPGClient) Commit() error
func (*TxPGClient) DeleteChild ¶
func (*TxPGClient) DeleteGrandparent ¶
func (*TxPGClient) DeleteParent ¶
func (*TxPGClient) GetGrandparent ¶
func (tx *TxPGClient) GetGrandparent( ctx context.Context, id int64, opts ...pggen.GetOpt, ) (*Grandparent, error)
func (*TxPGClient) GrandparentBulkFillIncludes ¶
func (tx *TxPGClient) GrandparentBulkFillIncludes( ctx context.Context, recs []*Grandparent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) GrandparentFillIncludes ¶
func (tx *TxPGClient) GrandparentFillIncludes( ctx context.Context, rec *Grandparent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) Handle ¶
func (tx *TxPGClient) Handle() pggen.DBHandle
func (*TxPGClient) InsertChild ¶
func (tx *TxPGClient) InsertChild( ctx context.Context, value *Child, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Child into the database. Returns the primary key of the inserted row.
func (*TxPGClient) InsertGrandparent ¶
func (tx *TxPGClient) InsertGrandparent( ctx context.Context, value *Grandparent, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Grandparent into the database. Returns the primary key of the inserted row.
func (*TxPGClient) InsertParent ¶
func (tx *TxPGClient) InsertParent( ctx context.Context, value *Parent, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a Parent into the database. Returns the primary key of the inserted row.
func (*TxPGClient) ListGrandparent ¶
func (tx *TxPGClient) ListGrandparent( ctx context.Context, ids []int64, opts ...pggen.ListOpt, ) (ret []Grandparent, err error)
func (*TxPGClient) ListParent ¶
func (*TxPGClient) ParentBulkFillIncludes ¶
func (tx *TxPGClient) ParentBulkFillIncludes( ctx context.Context, recs []*Parent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) ParentFillIncludes ¶
func (tx *TxPGClient) ParentFillIncludes( ctx context.Context, rec *Parent, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) Rollback ¶
func (tx *TxPGClient) Rollback() error
func (*TxPGClient) UpdateChild ¶
func (tx *TxPGClient) UpdateChild( ctx context.Context, value *Child, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Child. '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) UpdateGrandparent ¶
func (tx *TxPGClient) UpdateGrandparent( ctx context.Context, value *Grandparent, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Grandparent. '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) UpdateParent ¶
func (tx *TxPGClient) UpdateParent( ctx context.Context, value *Parent, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a Parent. '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) UpsertChild ¶
func (tx *TxPGClient) UpsertChild( ctx context.Context, value *Child, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Child 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.
func (*TxPGClient) UpsertGrandparent ¶
func (tx *TxPGClient) UpsertGrandparent( ctx context.Context, value *Grandparent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Grandparent 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.
func (*TxPGClient) UpsertParent ¶
func (tx *TxPGClient) UpsertParent( ctx context.Context, value *Parent, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a Parent 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.