Documentation ¶
Index ¶
- Constants
- Variables
- type ConnPGClient
- func (conn *ConnPGClient) BulkDeleteUser(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) BulkInsertUser(ctx context.Context, values []User, opts ...pggen.InsertOpt) ([]int64, error)
- func (conn *ConnPGClient) BulkUpsertUser(ctx context.Context, values []User, constraintNames []string, ...) (ret []int64, err error)
- func (conn *ConnPGClient) Close() error
- func (conn *ConnPGClient) DeleteUser(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (conn *ConnPGClient) GetUser(ctx context.Context, id int64, opts ...pggen.GetOpt) (*User, error)
- func (conn *ConnPGClient) GetUserNicknameAndEmail(ctx context.Context, arg1 int64) (ret []GetUserNicknameAndEmailRow, err error)
- func (conn *ConnPGClient) GetUserNicknameAndEmailQuery(ctx context.Context, arg1 int64) (*sql.Rows, error)
- func (conn *ConnPGClient) Handle() pggen.DBHandle
- func (conn *ConnPGClient) InsertUser(ctx context.Context, value *User, opts ...pggen.InsertOpt) (ret int64, err error)
- func (conn *ConnPGClient) ListUser(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []User, err error)
- func (conn *ConnPGClient) MyGetUser(ctx context.Context, arg1 int64) (ret []User, err error)
- func (conn *ConnPGClient) MyGetUserQuery(ctx context.Context, arg1 int64) (*sql.Rows, error)
- func (conn *ConnPGClient) UpdateUser(ctx context.Context, value *User, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (conn *ConnPGClient) UpsertUser(ctx context.Context, value *User, constraintNames []string, ...) (ret int64, err error)
- func (conn *ConnPGClient) UserBulkFillIncludes(ctx context.Context, recs []*User, includes *include.Spec, ...) error
- func (conn *ConnPGClient) UserFillIncludes(ctx context.Context, rec *User, includes *include.Spec, ...) error
- type DBQueries
- type GetUserNicknameAndEmailRow
- type PGClient
- func (p *PGClient) BeginTx(ctx context.Context, opts *sql.TxOptions) (*TxPGClient, error)
- func (p *PGClient) BulkDeleteUser(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) BulkInsertUser(ctx context.Context, values []User, opts ...pggen.InsertOpt) ([]int64, error)
- func (p *PGClient) BulkUpsertUser(ctx context.Context, values []User, constraintNames []string, ...) (ret []int64, err error)
- func (p *PGClient) Conn(ctx context.Context) (*ConnPGClient, error)
- func (p *PGClient) DeleteUser(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (p *PGClient) GetUser(ctx context.Context, id int64, opts ...pggen.GetOpt) (*User, error)
- func (p *PGClient) GetUserNicknameAndEmail(ctx context.Context, arg1 int64) (ret []GetUserNicknameAndEmailRow, err error)
- func (p *PGClient) GetUserNicknameAndEmailQuery(ctx context.Context, arg1 int64) (*sql.Rows, error)
- func (p *PGClient) Handle() pggen.DBHandle
- func (p *PGClient) InsertUser(ctx context.Context, value *User, opts ...pggen.InsertOpt) (ret int64, err error)
- func (p *PGClient) ListUser(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []User, err error)
- func (p *PGClient) MyGetUser(ctx context.Context, arg1 int64) (ret []User, err error)
- func (p *PGClient) MyGetUserQuery(ctx context.Context, arg1 int64) (*sql.Rows, error)
- func (p *PGClient) UpdateUser(ctx context.Context, value *User, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (p *PGClient) UpsertUser(ctx context.Context, value *User, constraintNames []string, ...) (ret int64, err error)
- func (p *PGClient) UserBulkFillIncludes(ctx context.Context, recs []*User, includes *include.Spec, ...) error
- func (p *PGClient) UserFillIncludes(ctx context.Context, rec *User, includes *include.Spec, ...) error
- type TxPGClient
- func (tx *TxPGClient) BulkDeleteUser(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) BulkInsertUser(ctx context.Context, values []User, opts ...pggen.InsertOpt) ([]int64, error)
- func (tx *TxPGClient) BulkUpsertUser(ctx context.Context, values []User, constraintNames []string, ...) (ret []int64, err error)
- func (tx *TxPGClient) Commit() error
- func (tx *TxPGClient) DeleteUser(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error
- func (tx *TxPGClient) GetUser(ctx context.Context, id int64, opts ...pggen.GetOpt) (*User, error)
- func (tx *TxPGClient) GetUserNicknameAndEmail(ctx context.Context, arg1 int64) (ret []GetUserNicknameAndEmailRow, err error)
- func (tx *TxPGClient) GetUserNicknameAndEmailQuery(ctx context.Context, arg1 int64) (*sql.Rows, error)
- func (tx *TxPGClient) Handle() pggen.DBHandle
- func (tx *TxPGClient) InsertUser(ctx context.Context, value *User, opts ...pggen.InsertOpt) (ret int64, err error)
- func (tx *TxPGClient) ListUser(ctx context.Context, ids []int64, opts ...pggen.ListOpt) (ret []User, err error)
- func (tx *TxPGClient) MyGetUser(ctx context.Context, arg1 int64) (ret []User, err error)
- func (tx *TxPGClient) MyGetUserQuery(ctx context.Context, arg1 int64) (*sql.Rows, error)
- func (tx *TxPGClient) Rollback() error
- func (tx *TxPGClient) UpdateUser(ctx context.Context, value *User, fieldMask pggen.FieldSet, ...) (ret int64, err error)
- func (tx *TxPGClient) UpsertUser(ctx context.Context, value *User, constraintNames []string, ...) (ret int64, err error)
- func (tx *TxPGClient) UserBulkFillIncludes(ctx context.Context, recs []*User, includes *include.Spec, ...) error
- func (tx *TxPGClient) UserFillIncludes(ctx context.Context, rec *User, includes *include.Spec, ...) error
- type User
Constants ¶
const ( UserIdFieldIndex int = 0 UserEmailFieldIndex int = 1 UserNicknameFieldIndex int = 2 UserMaxFieldIndex int = (3 - 1) )
bit indicies for 'fieldMask' parameters
Variables ¶
var UserAllFields pggen.FieldSet = pggen.NewFieldSetFilled(3)
A field set saying that all fields in User 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) BulkDeleteUser ¶
func (*ConnPGClient) BulkInsertUser ¶
func (conn *ConnPGClient) BulkInsertUser( ctx context.Context, values []User, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of User. Returns a list of the primary keys of the inserted rows.
func (*ConnPGClient) BulkUpsertUser ¶
func (conn *ConnPGClient) BulkUpsertUser( ctx context.Context, values []User, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of User 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) DeleteUser ¶
func (*ConnPGClient) GetUserNicknameAndEmail ¶
func (conn *ConnPGClient) GetUserNicknameAndEmail( ctx context.Context, arg1 int64, ) (ret []GetUserNicknameAndEmailRow, err error)
This comment will end up on the methods that are generated based on the query.
func (*ConnPGClient) GetUserNicknameAndEmailQuery ¶
func (conn *ConnPGClient) GetUserNicknameAndEmailQuery( ctx context.Context, arg1 int64, ) (*sql.Rows, error)
This comment will end up on the methods that are generated based on the query.
func (*ConnPGClient) Handle ¶
func (conn *ConnPGClient) Handle() pggen.DBHandle
func (*ConnPGClient) InsertUser ¶
func (conn *ConnPGClient) InsertUser( ctx context.Context, value *User, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a User into the database. Returns the primary key of the inserted row.
func (*ConnPGClient) MyGetUser ¶
This query returns a model struct. We let pggen know that via the return_type configuration option.
func (*ConnPGClient) MyGetUserQuery ¶
This query returns a model struct. We let pggen know that via the return_type configuration option.
func (*ConnPGClient) UpdateUser ¶
func (conn *ConnPGClient) UpdateUser( ctx context.Context, value *User, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a User. '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) UpsertUser ¶
func (conn *ConnPGClient) UpsertUser( ctx context.Context, value *User, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a User 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) UserBulkFillIncludes ¶
func (conn *ConnPGClient) UserBulkFillIncludes( ctx context.Context, recs []*User, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*ConnPGClient) UserFillIncludes ¶
func (conn *ConnPGClient) UserFillIncludes( ctx context.Context, rec *User, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
type DBQueries ¶
type DBQueries interface { // User methods GetUser(ctx context.Context, id int64, opts ...pggen.GetOpt) (*User, error) ListUser(ctx context.Context, ids []int64, opts ...pggen.ListOpt) ([]User, error) InsertUser(ctx context.Context, value *User, opts ...pggen.InsertOpt) (int64, error) BulkInsertUser(ctx context.Context, values []User, opts ...pggen.InsertOpt) ([]int64, error) UpdateUser(ctx context.Context, value *User, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt) (ret int64, err error) UpsertUser(ctx context.Context, value *User, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) (int64, error) BulkUpsertUser(ctx context.Context, values []User, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt) ([]int64, error) DeleteUser(ctx context.Context, id int64, opts ...pggen.DeleteOpt) error BulkDeleteUser(ctx context.Context, ids []int64, opts ...pggen.DeleteOpt) error UserFillIncludes(ctx context.Context, rec *User, includes *include.Spec, opts ...pggen.IncludeOpt) error UserBulkFillIncludes(ctx context.Context, recs []*User, includes *include.Spec, opts ...pggen.IncludeOpt) error // GetUserNicknameAndEmail query GetUserNicknameAndEmail( ctx context.Context, arg1 int64, ) ([]GetUserNicknameAndEmailRow, error) GetUserNicknameAndEmailQuery( ctx context.Context, arg1 int64, ) (*sql.Rows, error) // MyGetUser query MyGetUser( ctx context.Context, arg1 int64, ) ([]User, error) MyGetUserQuery( ctx context.Context, arg1 int64, ) (*sql.Rows, 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) BulkDeleteUser ¶
func (*PGClient) BulkInsertUser ¶
func (p *PGClient) BulkInsertUser( ctx context.Context, values []User, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of User. Returns a list of the primary keys of the inserted rows.
func (*PGClient) BulkUpsertUser ¶
func (p *PGClient) BulkUpsertUser( ctx context.Context, values []User, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of User 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) DeleteUser ¶
func (*PGClient) GetUserNicknameAndEmail ¶
func (p *PGClient) GetUserNicknameAndEmail( ctx context.Context, arg1 int64, ) (ret []GetUserNicknameAndEmailRow, err error)
This comment will end up on the methods that are generated based on the query.
func (*PGClient) GetUserNicknameAndEmailQuery ¶
func (p *PGClient) GetUserNicknameAndEmailQuery( ctx context.Context, arg1 int64, ) (*sql.Rows, error)
This comment will end up on the methods that are generated based on the query.
func (*PGClient) InsertUser ¶
func (p *PGClient) InsertUser( ctx context.Context, value *User, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a User into the database. Returns the primary key of the inserted row.
func (*PGClient) MyGetUser ¶
This query returns a model struct. We let pggen know that via the return_type configuration option.
func (*PGClient) MyGetUserQuery ¶
This query returns a model struct. We let pggen know that via the return_type configuration option.
func (*PGClient) UpdateUser ¶
func (p *PGClient) UpdateUser( ctx context.Context, value *User, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a User. '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) UpsertUser ¶
func (p *PGClient) UpsertUser( ctx context.Context, value *User, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a User 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) UserBulkFillIncludes ¶
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) BulkDeleteUser ¶
func (*TxPGClient) BulkInsertUser ¶
func (tx *TxPGClient) BulkInsertUser( ctx context.Context, values []User, opts ...pggen.InsertOpt, ) ([]int64, error)
Insert a list of User. Returns a list of the primary keys of the inserted rows.
func (*TxPGClient) BulkUpsertUser ¶
func (tx *TxPGClient) BulkUpsertUser( ctx context.Context, values []User, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret []int64, err error)
Upsert a set of User 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) DeleteUser ¶
func (*TxPGClient) GetUserNicknameAndEmail ¶
func (tx *TxPGClient) GetUserNicknameAndEmail( ctx context.Context, arg1 int64, ) (ret []GetUserNicknameAndEmailRow, err error)
This comment will end up on the methods that are generated based on the query.
func (*TxPGClient) GetUserNicknameAndEmailQuery ¶
func (tx *TxPGClient) GetUserNicknameAndEmailQuery( ctx context.Context, arg1 int64, ) (*sql.Rows, error)
This comment will end up on the methods that are generated based on the query.
func (*TxPGClient) Handle ¶
func (tx *TxPGClient) Handle() pggen.DBHandle
func (*TxPGClient) InsertUser ¶
func (tx *TxPGClient) InsertUser( ctx context.Context, value *User, opts ...pggen.InsertOpt, ) (ret int64, err error)
Insert a User into the database. Returns the primary key of the inserted row.
func (*TxPGClient) MyGetUser ¶
This query returns a model struct. We let pggen know that via the return_type configuration option.
func (*TxPGClient) MyGetUserQuery ¶
This query returns a model struct. We let pggen know that via the return_type configuration option.
func (*TxPGClient) Rollback ¶
func (tx *TxPGClient) Rollback() error
func (*TxPGClient) UpdateUser ¶
func (tx *TxPGClient) UpdateUser( ctx context.Context, value *User, fieldMask pggen.FieldSet, opts ...pggen.UpdateOpt, ) (ret int64, err error)
Update a User. '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) UpsertUser ¶
func (tx *TxPGClient) UpsertUser( ctx context.Context, value *User, constraintNames []string, fieldMask pggen.FieldSet, opts ...pggen.UpsertOpt, ) (ret int64, err error)
Upsert a User 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) UserBulkFillIncludes ¶
func (tx *TxPGClient) UserBulkFillIncludes( ctx context.Context, recs []*User, includes *include.Spec, opts ...pggen.IncludeOpt, ) error
func (*TxPGClient) UserFillIncludes ¶
func (tx *TxPGClient) UserFillIncludes( ctx context.Context, rec *User, includes *include.Spec, opts ...pggen.IncludeOpt, ) error