Documentation ¶
Index ¶
- func ReplaceGlobals(repository Repository) func()
- type PostgresRepository
- func (r *PostgresRepository) Create(variable models.VariablesConfig) (int64, error)
- func (r *PostgresRepository) Delete(id int64) error
- func (r *PostgresRepository) Get(id int64) (models.VariablesConfig, bool, error)
- func (r *PostgresRepository) GetAll() ([]models.VariablesConfig, error)
- func (r *PostgresRepository) GetAllAsMap() (map[string]interface{}, error)
- func (r *PostgresRepository) GetByKey(key string) (models.VariablesConfig, bool, error)
- func (r *PostgresRepository) Update(id int64, variable models.VariablesConfig) error
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceGlobals ¶
func ReplaceGlobals(repository Repository) func()
ReplaceGlobals affect a new repository to the global repository singleton
Types ¶
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
PostgresRepository is a repository containing the VariablesConfig definition based on a PSQL database and implementing the repository interface
func (*PostgresRepository) Create ¶
func (r *PostgresRepository) Create(variable models.VariablesConfig) (int64, error)
Create method used to create an Variable Config
func (*PostgresRepository) Delete ¶
func (r *PostgresRepository) Delete(id int64) error
Delete use to retrieve an Variable Config by id
func (*PostgresRepository) Get ¶
func (r *PostgresRepository) Get(id int64) (models.VariablesConfig, bool, error)
Get use to retrieve an variableConfig by id
func (*PostgresRepository) GetAll ¶
func (r *PostgresRepository) GetAll() ([]models.VariablesConfig, error)
GetAll method used to get all Variables Config
func (*PostgresRepository) GetAllAsMap ¶
func (r *PostgresRepository) GetAllAsMap() (map[string]interface{}, error)
GetAllAsMap method used to get all Variables Config as map[string]interface{}
func (*PostgresRepository) GetByKey ¶
func (r *PostgresRepository) GetByKey(key string) (models.VariablesConfig, bool, error)
GetByName use to retrieve an variableConfig by name
func (*PostgresRepository) Update ¶
func (r *PostgresRepository) Update(id int64, variable models.VariablesConfig) error
Update method used to update un Variable Config
type Repository ¶
type Repository interface { Get(id int64) (models.VariablesConfig, bool, error) GetByKey(key string) (models.VariablesConfig, bool, error) Create(variable models.VariablesConfig) (int64, error) Update(id int64, variable models.VariablesConfig) error Delete(id int64) error GetAll() ([]models.VariablesConfig, error) GetAllAsMap() (map[string]interface{}, error) }
Repository is a storage interface which can be implemented by multiple backend (in-memory map, sql database, in-memory cache, file system, ...) It allows standard CRUD operation on VariablesConfig
func NewPostgresRepository ¶
func NewPostgresRepository(dbClient *sqlx.DB) Repository
NewPostgresRepository returns a new instance of PostgresRepository