Documentation ¶
Index ¶
- func Connect(c *ConnectionConfig) (*gorm.DB, *sql.DB)
- func Reset(db *gorm.DB)
- type BattlesRepository
- type CommandersRepository
- func (r *CommandersRepository) CreateOne(data commanders.CreationInput) (uuid.UUID, error)
- func (r *CommandersRepository) FindMany(query commanders.FindManyQuery, page int) ([]commanders.Commander, int, error)
- func (r *CommandersRepository) FindOne(query commanders.FindOneQuery) (commanders.Commander, error)
- type ConnectionConfig
- type FactionsRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BattlesRepository ¶
type BattlesRepository struct {
// contains filtered or unexported fields
}
BattlesRepository is the repository that abstracts access to the underlying database operations used to query and mutate data relating to battles. This implementation relies on GORM and also executes validations before interacting with the database
func NewBattlesRepository ¶
func NewBattlesRepository(db *gorm.DB) *BattlesRepository
NewBattlesRepository returns a pointer to a ready-to-use postgresql.BattlesRepository
func (*BattlesRepository) CreateOne ¶
func (r *BattlesRepository) CreateOne(data battles.CreationInput) (uuid.UUID, error)
CreateOne creates a battle in the database, together with entries in the corresponding tables that let us relate the battle with other factions and commanders. The operation returns the ID of the new battle
func (*BattlesRepository) FindMany ¶
func (r *BattlesRepository) FindMany(query battles.FindManyQuery, page int) ([]battles.Battle, int, error)
FindMany does a paginated search of all battles matching the given query
func (*BattlesRepository) FindOne ¶
func (r *BattlesRepository) FindOne(query battles.FindOneQuery) (battles.Battle, error)
FindOne finds the first battle in the database that matches the query, together with its related factions and commanders
type CommandersRepository ¶
type CommandersRepository struct {
// contains filtered or unexported fields
}
CommandersRepository is the repository that abstracts access to the underlying database operations used to query and mutate data relating to commanders. This implementation relies on GORM and also executes validations before interacting with the database
func NewCommandersRepository ¶
func NewCommandersRepository(db *gorm.DB) *CommandersRepository
NewCommandersRepository returns a pointer to a ready-to-use postgresql.CommandersRepository
func (*CommandersRepository) CreateOne ¶
func (r *CommandersRepository) CreateOne(data commanders.CreationInput) (uuid.UUID, error)
CreateOne creates a commander in the database. The operation returns the ID of the new commander
func (*CommandersRepository) FindMany ¶
func (r *CommandersRepository) FindMany(query commanders.FindManyQuery, page int) ([]commanders.Commander, int, error)
FindMany does a paginated search of all commanders matching the given query
func (*CommandersRepository) FindOne ¶
func (r *CommandersRepository) FindOne(query commanders.FindOneQuery) (commanders.Commander, error)
FindOne finds the first commander in the database that matches the query
type ConnectionConfig ¶
ConnectionConfig is a struct that contains database connection configuration options
func DefaultTestConfig ¶
func DefaultTestConfig() *ConnectionConfig
DefaultTestConfig exposes a ConnectionConfig set up to work with the default test environment
type FactionsRepository ¶
type FactionsRepository struct {
// contains filtered or unexported fields
}
FactionsRepository is the repository that abstracts access to the underlying database operations used to query and mutate data relating to factions. This implementation relies on GORM and also executes validations before interacting with the database
func NewFactionsRepository ¶
func NewFactionsRepository(db *gorm.DB) *FactionsRepository
NewFactionsRepository returns a pointer to a ready-to-use postgresql.FactionsRepository
func (*FactionsRepository) CreateOne ¶
func (r *FactionsRepository) CreateOne(data factions.CreationInput) (uuid.UUID, error)
CreateOne creates a faction in the database. The operation returns the ID of the new faction
func (*FactionsRepository) FindMany ¶
func (r *FactionsRepository) FindMany(query factions.FindManyQuery, page int) ([]factions.Faction, int, error)
FindMany does a paginated search of all factions matching the given query
func (*FactionsRepository) FindOne ¶
func (r *FactionsRepository) FindOne(query factions.FindOneQuery) (factions.Faction, error)
FindOne finds the first faction in the database that matches the query