playerrepo

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

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

View Source
const Table = "players"

Table is the database table

Variables

This section is empty.

Functions

func AgeEq

func AgeEq(age int) comparison.PredFunc

AgeEq equal operator on Age field

func AgeGt

func AgeGt(age int) comparison.PredFunc

AgeGt greater than operator on Age field

func AgeGtOrEq

func AgeGtOrEq(age int) comparison.PredFunc

AgeGtOrEq greater than or equal operator on Age field

func AgeIn

func AgeIn(ages ...int) comparison.PredFunc

AgeIn in operator on Age field

func AgeLt

func AgeLt(age int) comparison.PredFunc

AgeLt less than operator on Age field

func AgeLtOrEq

func AgeLtOrEq(age int) comparison.PredFunc

AgeLtOrEq less than or equal operator on Age field

func AgeNotEq

func AgeNotEq(age int) comparison.PredFunc

AgeNotEq not equal operator on Age field

func AgeNotIn

func AgeNotIn(ages ...int) comparison.PredFunc

AgeNotIn not in operator on Age field

func Asc

func Asc(field Field) sort.SortFunc

Asc ascending sort direction

func Avg

func Avg(field Field) aggregate.AggFunc

Avg is the average aggregate operator

func Count

func Count(field Field) aggregate.AggFunc

Count is the count aggregate operator

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 Desc

func Desc(field Field) sort.SortFunc

Desc descending sort direction

func EmailEq

func EmailEq(email string) comparison.PredFunc

EmailEq equal operator on Email 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 IDEq

func IDEq(id string) comparison.PredFunc

IDEq equal operator on ID field

func IDIn

func IDIn(ids ...string) comparison.PredFunc

IDIn in operator on ID field

func IDNotEq

func IDNotEq(id string) comparison.PredFunc

IDNotEq not equal operator on ID field

func IDNotIn

func IDNotIn(ids ...string) comparison.PredFunc

IDNotIn not in operator on ID field

func Max

func Max(field Field) aggregate.AggFunc

Max is the max aggregate operator

func Min

func Min(field Field) aggregate.AggFunc

Min is the min aggregate operator

func NameEq

func NameEq(name string) comparison.PredFunc

NameEq equal operator on Name field

func NameIn

func NameIn(names ...string) comparison.PredFunc

NameIn in operator on Name field

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 None

func None(field Field) aggregate.AggFunc

None is the none aggregate operator

func RaceEq

func RaceEq(race player.Race) comparison.PredFunc

RaceEq equal operator on Race 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 Sum

func Sum(field Field) aggregate.AggFunc

Sum is the sum aggregate operator

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

func NewCreator

func NewCreator() *Creator

NewCreator returns a Creator

func (*Creator) Age

func (c *Creator) Age(age int) *Creator

Age sets the Age field

func (*Creator) Email

func (c *Creator) Email(email string) *Creator

Email sets the Email field

func (*Creator) Name

func (c *Creator) Name(name string) *Creator

Name sets the Name field

func (*Creator) Race

func (c *Creator) Race(race player.Race) *Creator

Race sets the Race field

func (*Creator) UpdatedAt

func (c *Creator) UpdatedAt(updatedAt *time.Time) *Creator

UpdatedAt sets the UpdatedAt field

func (*Creator) Validate

func (c *Creator) Validate() error

Validate validates the fields

type Deleter

type Deleter struct {
	// contains filtered or unexported fields
}

Deleter is a delete builder

func NewDeleter

func NewDeleter() *Deleter

NewDeleter returns a Deleter

func (*Deleter) Where

func (d *Deleter) Where(predFuncs ...comparison.PredFunc) *Deleter

Where applies predicates

type Field

type Field int

Field is a Player field

const (
	FieldID Field = iota + 1
	FieldEmail
	FieldName
	FieldAge
	FieldRace
	FieldUpdatedAt
	FieldCreatedAt
)

func (Field) String

func (f Field) String() string

String returns the string representation of the field

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) BeginTx

func (repo *PostgresRepository) BeginTx(ctx context.Context) (nero.Tx, error)

BeginTx starts a transaction

func (*PostgresRepository) Create

func (repo *PostgresRepository) Create(ctx context.Context, c *Creator) (string, error)

Create creates a Player

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) Delete

func (repo *PostgresRepository) Delete(ctx context.Context, d *Deleter) (int64, error)

Delete deletes a Player or many Players

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) Query

func (repo *PostgresRepository) Query(ctx context.Context, q *Queryer) ([]*player.Player, error)

Query queries Players

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) QueryOne

func (repo *PostgresRepository) QueryOne(ctx context.Context, q *Queryer) (*player.Player, error)

QueryOne queries a Player

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) Update

func (repo *PostgresRepository) Update(ctx context.Context, u *Updater) (int64, error)

Update updates a Player or many Players

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

func NewQueryer

func NewQueryer() *Queryer

NewQueryer returns a Queryer

func (*Queryer) Limit

func (q *Queryer) Limit(limit uint) *Queryer

Limit applies limit

func (*Queryer) Offset

func (q *Queryer) Offset(offset uint) *Queryer

Offset applies offset

func (*Queryer) Sort

func (q *Queryer) Sort(sortFuncs ...sort.SortFunc) *Queryer

Sort applies sorting expressions

func (*Queryer) Where

func (q *Queryer) Where(predFuncs ...comparison.PredFunc) *Queryer

Where applies predicates

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) BeginTx

func (repo *SQLiteRepository) BeginTx(ctx context.Context) (nero.Tx, error)

BeginTx starts a transaction

func (*SQLiteRepository) Create

func (repo *SQLiteRepository) Create(ctx context.Context, c *Creator) (string, error)

Create creates a Player

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

func (repo *SQLiteRepository) CreateManyInTx(ctx context.Context, tx nero.Tx, cs ...*Creator) error

CreateManyInTx batch creates Players in a transaction

func (*SQLiteRepository) Debug

func (repo *SQLiteRepository) Debug() *SQLiteRepository

Debug enables debug mode

func (*SQLiteRepository) Delete

func (repo *SQLiteRepository) Delete(ctx context.Context, d *Deleter) (int64, error)

Delete deletes a Player or many Players

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) Query

func (repo *SQLiteRepository) Query(ctx context.Context, q *Queryer) ([]*player.Player, error)

Query queries Players

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) QueryOne

func (repo *SQLiteRepository) QueryOne(ctx context.Context, q *Queryer) (*player.Player, error)

QueryOne queries a Player

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) Update

func (repo *SQLiteRepository) Update(ctx context.Context, u *Updater) (int64, error)

Update updates a Player or many Players

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

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater is an update builder

func NewUpdater

func NewUpdater() *Updater

NewUpdater returns an Updater

func (*Updater) Age

func (c *Updater) Age(age int) *Updater

Age sets the Age field

func (*Updater) Email

func (c *Updater) Email(email string) *Updater

Email sets the Email field

func (*Updater) Name

func (c *Updater) Name(name string) *Updater

Name sets the Name field

func (*Updater) Race

func (c *Updater) Race(race player.Race) *Updater

Race sets the Race field

func (*Updater) UpdatedAt

func (c *Updater) UpdatedAt(updatedAt *time.Time) *Updater

UpdatedAt sets the UpdatedAt field

func (*Updater) Where

func (u *Updater) Where(predFuncs ...comparison.PredFunc) *Updater

Where applies predicates

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL