orm

package
v0.3.0-alpha1 Latest Latest
Warning

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

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

README

#package orm(pkg/storage/orm)

This package contains tests, and methods for creating, deleting, updating, retrieving models using https://github.com/go-gorm/gorm library.

Every file with {model_name}_repo.go file has a struct named {model_name}Repo that implements the respective interface located at pkg/{model_name}/{model_name}_repo/repo.go file. These interfaces typically consist of the following methods:

  • Get: Gets the first row, this is a method that usually exists in models that only have one row
  • GetAll: Gets all entries
  • GetByID: Get a specific model by ID
  • Store: Stores a new model in the respective table
  • Upsert: Creates new entries, unless the entries already exist(this is useful when loading the competition. Check the details at pkg/competition/competitionservice/serv.go)
  • Update: Updates the entry
  • Delete: Deletes the entry
  • <Other>: Model specific methods.

All the methods take the context, that is then passed down to gorm when making the request for cancellation propagation.

Every test that is spawned locally will utilize pkg/storage/orm/dev-config.yml as input config by default.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIDMissing = errors.New("the ID should be provided")
View Source
var ErrNoRoundExecuting = errors.New("there is no round executing at the moment")
View Source
var ErrTeamNameMissing = errors.New("team name missing")

Functions

func NewCheckRepo

func NewCheckRepo(db *gorm.DB) checkrepo.Repo

func NewConfigRepo

func NewConfigRepo(db *gorm.DB) configrepo.Repo

func NewHostGroupRepo

func NewHostGroupRepo(db *gorm.DB) hostgrouprepo.Repo

func NewHostRepo

func NewHostRepo(db *gorm.DB) hostrepo.Repo

func NewPolicyRepo

func NewPolicyRepo(db *gorm.DB) policyrepo.Repo

func NewPropertyRepo

func NewPropertyRepo(db *gorm.DB) propertyrepo.Repo

func NewReportRepo

func NewReportRepo(db *gorm.DB) reportrepo.Repo

func NewRoundRepo

func NewRoundRepo(db *gorm.DB) roundrepo.Repo

func NewServiceGroupRepo

func NewServiceGroupRepo(db *gorm.DB) servicegrouprepo.Repo

func NewServiceRepo

func NewServiceRepo(db *gorm.DB) servicerepo.Repo

func NewTeamRepo

func NewTeamRepo(db *gorm.DB) teamrepo.Repo

func NewUserRepo

func NewUserRepo(db *gorm.DB) userrepo.Repo

func ReplaceInvalidCharacters

func ReplaceInvalidCharacters(chck []*check.Check)

Types

type NoRowsAffected

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

func (*NoRowsAffected) Error

func (e *NoRowsAffected) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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