Documentation ¶
Overview ¶
Code generated by nero, DO NOT EDIT.
Code generated by nero, DO NOT EDIT.
Code generated by nero, DO NOT EDIT.
Code generated by nero, DO NOT EDIT.
Code generated by nero, DO NOT EDIT.
Code generated by nero, DO NOT EDIT.
Code generated by nero, DO NOT EDIT.
Index ¶
- Constants
- func AgeEq(age int) comparison.PredFunc
- func AgeGt(age int) comparison.PredFunc
- func AgeGtOrEq(age int) comparison.PredFunc
- func AgeIn(ages ...int) comparison.PredFunc
- func AgeLt(age int) comparison.PredFunc
- func AgeLtOrEq(age int) comparison.PredFunc
- func AgeNotEq(age int) comparison.PredFunc
- func AgeNotIn(ages ...int) comparison.PredFunc
- func Asc(field Field) sort.SortFunc
- func Avg(field Field) aggregate.AggFunc
- func Count(field Field) aggregate.AggFunc
- func CreatedAtEq(createdAt *time.Time) comparison.PredFunc
- func CreatedAtGt(createdAt *time.Time) comparison.PredFunc
- func CreatedAtGtOrEq(createdAt *time.Time) comparison.PredFunc
- func CreatedAtIn(createdAts ...*time.Time) comparison.PredFunc
- func CreatedAtIsNotNull() comparison.PredFunc
- func CreatedAtIsNull() comparison.PredFunc
- func CreatedAtLt(createdAt *time.Time) comparison.PredFunc
- func CreatedAtLtOrEq(createdAt *time.Time) comparison.PredFunc
- func CreatedAtNotEq(createdAt *time.Time) comparison.PredFunc
- func CreatedAtNotIn(createdAts ...*time.Time) comparison.PredFunc
- func Desc(field Field) sort.SortFunc
- func EmailEq(email string) comparison.PredFunc
- func EmailIn(emails ...string) comparison.PredFunc
- func EmailNotEq(email string) comparison.PredFunc
- func EmailNotIn(emails ...string) comparison.PredFunc
- func FieldXEqFieldY(fieldX, fieldY Field) comparison.PredFunc
- func FieldXGtFieldY(fieldX, fieldY Field) comparison.PredFunc
- func FieldXGtOrEqFieldY(fieldX, fieldY Field) comparison.PredFunc
- func FieldXLtFieldY(fieldX, fieldY Field) comparison.PredFunc
- func FieldXLtOrEqFieldY(fieldX, fieldY Field) comparison.PredFunc
- func FieldXNotEqFieldY(fieldX, fieldY Field) comparison.PredFunc
- func IDEq(id string) comparison.PredFunc
- func IDIn(ids ...string) comparison.PredFunc
- func IDNotEq(id string) comparison.PredFunc
- func IDNotIn(ids ...string) comparison.PredFunc
- func Max(field Field) aggregate.AggFunc
- func Min(field Field) aggregate.AggFunc
- func NameEq(name string) comparison.PredFunc
- func NameIn(names ...string) comparison.PredFunc
- func NameNotEq(name string) comparison.PredFunc
- func NameNotIn(names ...string) comparison.PredFunc
- func None(field Field) aggregate.AggFunc
- func RaceEq(race player.Race) comparison.PredFunc
- func RaceIn(races ...player.Race) comparison.PredFunc
- func RaceNotEq(race player.Race) comparison.PredFunc
- func RaceNotIn(races ...player.Race) comparison.PredFunc
- func Sum(field Field) aggregate.AggFunc
- func UpdatedAtEq(updatedAt *time.Time) comparison.PredFunc
- func UpdatedAtGt(updatedAt *time.Time) comparison.PredFunc
- func UpdatedAtGtOrEq(updatedAt *time.Time) comparison.PredFunc
- func UpdatedAtIn(updatedAts ...*time.Time) comparison.PredFunc
- func UpdatedAtIsNotNull() comparison.PredFunc
- func UpdatedAtIsNull() comparison.PredFunc
- func UpdatedAtLt(updatedAt *time.Time) comparison.PredFunc
- func UpdatedAtLtOrEq(updatedAt *time.Time) comparison.PredFunc
- func UpdatedAtNotEq(updatedAt *time.Time) comparison.PredFunc
- func UpdatedAtNotIn(updatedAts ...*time.Time) comparison.PredFunc
- type Aggregator
- type Creator
- type Deleter
- type Field
- type PostgresRepository
- func (repo *PostgresRepository) Aggregate(ctx context.Context, a *Aggregator) error
- func (repo *PostgresRepository) AggregateInTx(ctx context.Context, tx nero.Tx, a *Aggregator) error
- func (repo *PostgresRepository) BeginTx(ctx context.Context) (nero.Tx, error)
- func (repo *PostgresRepository) Create(ctx context.Context, c *Creator) (string, error)
- func (repo *PostgresRepository) CreateInTx(ctx context.Context, tx nero.Tx, c *Creator) (string, error)
- func (repo *PostgresRepository) CreateMany(ctx context.Context, cs ...*Creator) error
- func (repo *PostgresRepository) CreateManyInTx(ctx context.Context, tx nero.Tx, cs ...*Creator) error
- func (repo *PostgresRepository) Debug() *PostgresRepository
- func (repo *PostgresRepository) Delete(ctx context.Context, d *Deleter) (int64, error)
- func (repo *PostgresRepository) DeleteInTx(ctx context.Context, tx nero.Tx, d *Deleter) (int64, error)
- func (repo *PostgresRepository) Query(ctx context.Context, q *Queryer) ([]*player.Player, error)
- func (repo *PostgresRepository) QueryInTx(ctx context.Context, tx nero.Tx, q *Queryer) ([]*player.Player, error)
- func (repo *PostgresRepository) QueryOne(ctx context.Context, q *Queryer) (*player.Player, error)
- func (repo *PostgresRepository) QueryOneInTx(ctx context.Context, tx nero.Tx, q *Queryer) (*player.Player, error)
- func (repo *PostgresRepository) Update(ctx context.Context, u *Updater) (int64, error)
- func (repo *PostgresRepository) UpdateInTx(ctx context.Context, tx nero.Tx, u *Updater) (int64, error)
- func (repo *PostgresRepository) WithLogger(logger nero.Logger) *PostgresRepository
- type Queryer
- type Repository
- type SQLiteRepository
- func (repo *SQLiteRepository) Aggregate(ctx context.Context, a *Aggregator) error
- func (repo *SQLiteRepository) AggregateInTx(ctx context.Context, tx nero.Tx, a *Aggregator) error
- func (repo *SQLiteRepository) BeginTx(ctx context.Context) (nero.Tx, error)
- func (repo *SQLiteRepository) Create(ctx context.Context, c *Creator) (string, error)
- func (repo *SQLiteRepository) CreateInTx(ctx context.Context, tx nero.Tx, c *Creator) (string, error)
- func (repo *SQLiteRepository) CreateMany(ctx context.Context, cs ...*Creator) error
- func (repo *SQLiteRepository) CreateManyInTx(ctx context.Context, tx nero.Tx, cs ...*Creator) error
- func (repo *SQLiteRepository) Debug() *SQLiteRepository
- func (repo *SQLiteRepository) Delete(ctx context.Context, d *Deleter) (int64, error)
- func (repo *SQLiteRepository) DeleteInTx(ctx context.Context, tx nero.Tx, d *Deleter) (int64, error)
- func (repo *SQLiteRepository) Query(ctx context.Context, q *Queryer) ([]*player.Player, error)
- func (repo *SQLiteRepository) QueryInTx(ctx context.Context, tx nero.Tx, q *Queryer) ([]*player.Player, error)
- func (repo *SQLiteRepository) QueryOne(ctx context.Context, q *Queryer) (*player.Player, error)
- func (repo *SQLiteRepository) QueryOneInTx(ctx context.Context, tx nero.Tx, q *Queryer) (*player.Player, error)
- func (repo *SQLiteRepository) Update(ctx context.Context, u *Updater) (int64, error)
- func (repo *SQLiteRepository) UpdateInTx(ctx context.Context, tx nero.Tx, u *Updater) (int64, error)
- func (repo *SQLiteRepository) WithLogger(logger nero.Logger) *SQLiteRepository
- type Updater
- func (c *Updater) Age(age int) *Updater
- func (c *Updater) Email(email string) *Updater
- func (c *Updater) Name(name string) *Updater
- func (c *Updater) Race(race player.Race) *Updater
- func (c *Updater) UpdatedAt(updatedAt *time.Time) *Updater
- func (u *Updater) Where(predFuncs ...comparison.PredFunc) *Updater
Constants ¶
const Table = "players"
Table is the database table
Variables ¶
This section is empty.
Functions ¶
func AgeGtOrEq ¶
func AgeGtOrEq(age int) comparison.PredFunc
AgeGtOrEq greater than or equal operator on Age field
func AgeLtOrEq ¶
func AgeLtOrEq(age int) comparison.PredFunc
AgeLtOrEq less than or equal operator on Age field
func AgeNotIn ¶
func AgeNotIn(ages ...int) comparison.PredFunc
AgeNotIn not in operator on Age field
func CreatedAtEq ¶
func CreatedAtEq(createdAt *time.Time) comparison.PredFunc
CreatedAtEq equal operator on CreatedAt field
func CreatedAtGt ¶
func CreatedAtGt(createdAt *time.Time) comparison.PredFunc
CreatedAtGt greater than operator on CreatedAt field
func CreatedAtGtOrEq ¶
func CreatedAtGtOrEq(createdAt *time.Time) comparison.PredFunc
CreatedAtGtOrEq greater than or equal operator on CreatedAt field
func CreatedAtIn ¶
func CreatedAtIn(createdAts ...*time.Time) comparison.PredFunc
CreatedAtIn in operator on CreatedAt field
func CreatedAtIsNotNull ¶
func CreatedAtIsNotNull() comparison.PredFunc
CreatedAtIsNotNull is not null operator on CreatedAt field
func CreatedAtIsNull ¶
func CreatedAtIsNull() comparison.PredFunc
CreatedAtIsNull is null operator on CreatedAt field
func CreatedAtLt ¶
func CreatedAtLt(createdAt *time.Time) comparison.PredFunc
CreatedAtLt less than operator on CreatedAt field
func CreatedAtLtOrEq ¶
func CreatedAtLtOrEq(createdAt *time.Time) comparison.PredFunc
CreatedAtLtOrEq less than or equal operator on CreatedAt field
func CreatedAtNotEq ¶
func CreatedAtNotEq(createdAt *time.Time) comparison.PredFunc
CreatedAtNotEq not equal operator on CreatedAt field
func CreatedAtNotIn ¶
func CreatedAtNotIn(createdAts ...*time.Time) comparison.PredFunc
CreatedAtNotIn not in operator on CreatedAt field
func EmailIn ¶
func EmailIn(emails ...string) comparison.PredFunc
EmailIn in operator on Email field
func EmailNotEq ¶
func EmailNotEq(email string) comparison.PredFunc
EmailNotEq not equal operator on Email field
func EmailNotIn ¶
func EmailNotIn(emails ...string) comparison.PredFunc
EmailNotIn not in operator on Email field
func FieldXEqFieldY ¶
func FieldXEqFieldY(fieldX, fieldY Field) comparison.PredFunc
FieldXEqFieldY fieldX equal fieldY
fieldX and fieldY must be of the same type
func FieldXGtFieldY ¶
func FieldXGtFieldY(fieldX, fieldY Field) comparison.PredFunc
FieldXGtFieldY fieldX greater than fieldY
fieldX and fieldY must be of the same type
func FieldXGtOrEqFieldY ¶
func FieldXGtOrEqFieldY(fieldX, fieldY Field) comparison.PredFunc
FieldXGtOrEqFieldY fieldX greater than or equal fieldY
fieldX and fieldY must be of the same type
func FieldXLtFieldY ¶
func FieldXLtFieldY(fieldX, fieldY Field) comparison.PredFunc
FieldXLtFieldY fieldX less than fieldY
fieldX and fieldY must be of the same type
func FieldXLtOrEqFieldY ¶
func FieldXLtOrEqFieldY(fieldX, fieldY Field) comparison.PredFunc
FieldXLtOrEqFieldY fieldX less than or equal fieldY
fieldX and fieldY must be of the same type
func FieldXNotEqFieldY ¶
func FieldXNotEqFieldY(fieldX, fieldY Field) comparison.PredFunc
FieldXNotEqFieldY fieldX not equal fieldY
fieldX and fieldY must be of the same type
func NameNotEq ¶
func NameNotEq(name string) comparison.PredFunc
NameNotEq not equal operator on Name field
func NameNotIn ¶
func NameNotIn(names ...string) comparison.PredFunc
NameNotIn not in operator on Name field
func RaceIn ¶
func RaceIn(races ...player.Race) comparison.PredFunc
RaceIn in operator on Race field
func RaceNotEq ¶
func RaceNotEq(race player.Race) comparison.PredFunc
RaceNotEq not equal operator on Race field
func RaceNotIn ¶
func RaceNotIn(races ...player.Race) comparison.PredFunc
RaceNotIn not in operator on Race field
func UpdatedAtEq ¶
func UpdatedAtEq(updatedAt *time.Time) comparison.PredFunc
UpdatedAtEq equal operator on UpdatedAt field
func UpdatedAtGt ¶
func UpdatedAtGt(updatedAt *time.Time) comparison.PredFunc
UpdatedAtGt greater than operator on UpdatedAt field
func UpdatedAtGtOrEq ¶
func UpdatedAtGtOrEq(updatedAt *time.Time) comparison.PredFunc
UpdatedAtGtOrEq greater than or equal operator on UpdatedAt field
func UpdatedAtIn ¶
func UpdatedAtIn(updatedAts ...*time.Time) comparison.PredFunc
UpdatedAtIn in operator on UpdatedAt field
func UpdatedAtIsNotNull ¶
func UpdatedAtIsNotNull() comparison.PredFunc
UpdatedAtIsNotNull is not null operator on UpdatedAt field
func UpdatedAtIsNull ¶
func UpdatedAtIsNull() comparison.PredFunc
UpdatedAtIsNull is null operator on UpdatedAt field
func UpdatedAtLt ¶
func UpdatedAtLt(updatedAt *time.Time) comparison.PredFunc
UpdatedAtLt less than operator on UpdatedAt field
func UpdatedAtLtOrEq ¶
func UpdatedAtLtOrEq(updatedAt *time.Time) comparison.PredFunc
UpdatedAtLtOrEq less than or equal operator on UpdatedAt field
func UpdatedAtNotEq ¶
func UpdatedAtNotEq(updatedAt *time.Time) comparison.PredFunc
UpdatedAtNotEq not equal operator on UpdatedAt field
func UpdatedAtNotIn ¶
func UpdatedAtNotIn(updatedAts ...*time.Time) comparison.PredFunc
UpdatedAtNotIn not in operator on UpdatedAt field
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
Aggregator is an aggregate query builder
func NewAggregator ¶
func NewAggregator(v interface{}) *Aggregator
NewAggregator expects a v and returns an Aggregator where 'v' argument must be an array of struct
func (*Aggregator) Aggregate ¶
func (a *Aggregator) Aggregate(aggFuncs ...aggregate.AggFunc) *Aggregator
Aggregate applies aggregate functions
func (*Aggregator) GroupBy ¶
func (a *Aggregator) GroupBy(fields ...Field) *Aggregator
Group applies group clauses
func (*Aggregator) Sort ¶
func (a *Aggregator) Sort(sortFuncs ...sort.SortFunc) *Aggregator
Sort applies sorting expressions
func (*Aggregator) Where ¶
func (a *Aggregator) Where(predFuncs ...comparison.PredFunc) *Aggregator
Where applies predicates
type Creator ¶
type Creator struct {
// contains filtered or unexported fields
}
Creator is a create builder
type Deleter ¶
type Deleter struct {
// contains filtered or unexported fields
}
Deleter is a delete builder
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
PostgresRepository is a repository that uses PostgreSQL as data store
func NewPostgresRepository ¶
func NewPostgresRepository(db *sql.DB) *PostgresRepository
NewPostgresRepository returns a PostgresRepository
func (*PostgresRepository) Aggregate ¶
func (repo *PostgresRepository) Aggregate(ctx context.Context, a *Aggregator) error
Aggregate performs an aggregate query
func (*PostgresRepository) AggregateInTx ¶
func (repo *PostgresRepository) AggregateInTx(ctx context.Context, tx nero.Tx, a *Aggregator) error
AggregateInTx performs an aggregate query in a transaction
func (*PostgresRepository) CreateInTx ¶
func (repo *PostgresRepository) CreateInTx(ctx context.Context, tx nero.Tx, c *Creator) (string, error)
CreateInTx creates a Player in a transaction
func (*PostgresRepository) CreateMany ¶
func (repo *PostgresRepository) CreateMany(ctx context.Context, cs ...*Creator) error
CreateMany batch creates Players
func (*PostgresRepository) CreateManyInTx ¶
func (repo *PostgresRepository) CreateManyInTx(ctx context.Context, tx nero.Tx, cs ...*Creator) error
CreateManyInTx batch creates Players in a transaction
func (*PostgresRepository) Debug ¶
func (repo *PostgresRepository) Debug() *PostgresRepository
Debug enables debug mode
func (*PostgresRepository) DeleteInTx ¶
func (repo *PostgresRepository) DeleteInTx(ctx context.Context, tx nero.Tx, d *Deleter) (int64, error)
DeleteInTx deletes a Player or many Players in a transaction
func (*PostgresRepository) QueryInTx ¶
func (repo *PostgresRepository) QueryInTx(ctx context.Context, tx nero.Tx, q *Queryer) ([]*player.Player, error)
QueryInTx queries Players in a transaction
func (*PostgresRepository) QueryOneInTx ¶
func (repo *PostgresRepository) QueryOneInTx(ctx context.Context, tx nero.Tx, q *Queryer) (*player.Player, error)
QueryOneInTx queries a Player in a transaction
func (*PostgresRepository) UpdateInTx ¶
func (repo *PostgresRepository) UpdateInTx(ctx context.Context, tx nero.Tx, u *Updater) (int64, error)
UpdateInTx updates a Player many Players in a transaction
func (*PostgresRepository) WithLogger ¶
func (repo *PostgresRepository) WithLogger(logger nero.Logger) *PostgresRepository
WithLogger overrides the default logger
type Queryer ¶
type Queryer struct {
// contains filtered or unexported fields
}
Queryer is a query builder
type Repository ¶
type Repository interface { // BeginTx starts a transaction BeginTx(context.Context) (nero.Tx, error) // Create creates a Player Create(context.Context, *Creator) (id string, err error) // CreateInTx creates a Player in a transaction CreateInTx(context.Context, nero.Tx, *Creator) (id string, err error) // CreateMany batch creates Players CreateMany(context.Context, ...*Creator) error // CreateManyInTx batch creates Players in a transaction CreateManyInTx(context.Context, nero.Tx, ...*Creator) error // Query queries Players Query(context.Context, *Queryer) ([]*player.Player, error) // QueryTx queries Players in a transaction QueryInTx(context.Context, nero.Tx, *Queryer) ([]*player.Player, error) // QueryOne queries a Player QueryOne(context.Context, *Queryer) (*player.Player, error) // QueryOneTx queries a Player in a transaction QueryOneInTx(context.Context, nero.Tx, *Queryer) (*player.Player, error) // Update updates a Player or many Players Update(context.Context, *Updater) (rowsAffected int64, err error) // UpdateTx updates a Player many Players in a transaction UpdateInTx(context.Context, nero.Tx, *Updater) (rowsAffected int64, err error) // Delete deletes a Player or many Players Delete(context.Context, *Deleter) (rowsAffected int64, err error) // Delete deletes a Player or many Players in a transaction DeleteInTx(context.Context, nero.Tx, *Deleter) (rowsAffected int64, err error) // Aggregate performs an aggregate query Aggregate(context.Context, *Aggregator) error // Aggregate performs an aggregate query in a transaction AggregateInTx(context.Context, nero.Tx, *Aggregator) error }
Repository is an interface that provides the methods for interacting with a Player repository
type SQLiteRepository ¶
type SQLiteRepository struct {
// contains filtered or unexported fields
}
SQLiteRepository is a repository that uses SQLite3 as data store
func NewSQLiteRepository ¶
func NewSQLiteRepository(db *sql.DB) *SQLiteRepository
NewSQLiteRepository returns a new SQLiteRepository
func (*SQLiteRepository) Aggregate ¶
func (repo *SQLiteRepository) Aggregate(ctx context.Context, a *Aggregator) error
Aggregate runs an aggregate query
func (*SQLiteRepository) AggregateInTx ¶
func (repo *SQLiteRepository) AggregateInTx(ctx context.Context, tx nero.Tx, a *Aggregator) error
AggregateInTx runs an aggregate query in a transaction
func (*SQLiteRepository) CreateInTx ¶
func (repo *SQLiteRepository) CreateInTx(ctx context.Context, tx nero.Tx, c *Creator) (string, error)
CreateInTx creates a Player in a transaction
func (*SQLiteRepository) CreateMany ¶
func (repo *SQLiteRepository) CreateMany(ctx context.Context, cs ...*Creator) error
CreateMany batch creates Players
func (*SQLiteRepository) CreateManyInTx ¶
CreateManyInTx batch creates Players in a transaction
func (*SQLiteRepository) Debug ¶
func (repo *SQLiteRepository) Debug() *SQLiteRepository
Debug enables debug mode
func (*SQLiteRepository) DeleteInTx ¶
func (repo *SQLiteRepository) DeleteInTx(ctx context.Context, tx nero.Tx, d *Deleter) (int64, error)
DeleteInTx deletes a Player or many Players in a transaction
func (*SQLiteRepository) QueryInTx ¶
func (repo *SQLiteRepository) QueryInTx(ctx context.Context, tx nero.Tx, q *Queryer) ([]*player.Player, error)
QueryInTx queries Players in a transaction
func (*SQLiteRepository) QueryOneInTx ¶
func (repo *SQLiteRepository) QueryOneInTx(ctx context.Context, tx nero.Tx, q *Queryer) (*player.Player, error)
QueryOneInTx queries a Player in a transaction
func (*SQLiteRepository) UpdateInTx ¶
func (repo *SQLiteRepository) UpdateInTx(ctx context.Context, tx nero.Tx, u *Updater) (int64, error)
UpdateInTx updates a Player many Players in a transaction
func (*SQLiteRepository) WithLogger ¶
func (repo *SQLiteRepository) WithLogger(logger nero.Logger) *SQLiteRepository
WithLogger overrides the default logger