Documentation ¶
Index ¶
- func ReplaceGlobals(repository Repository) func()
- type PostgresRepository
- func (r *PostgresRepository) Create(externalConfig models.ExternalConfig) (int64, error)
- func (r *PostgresRepository) Delete(id int64) error
- func (r *PostgresRepository) Get(id int64) (models.ExternalConfig, bool, error)
- func (r *PostgresRepository) GetAll() (map[int64]models.ExternalConfig, error)
- func (r *PostgresRepository) GetByName(name string) (models.ExternalConfig, bool, error)
- func (r *PostgresRepository) Update(id int64, externalConfig models.ExternalConfig) 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 ExternalConfig definition based on a PSQL database and implementing the repository interface
func (*PostgresRepository) Create ¶
func (r *PostgresRepository) Create(externalConfig models.ExternalConfig) (int64, error)
Create method used to create an externalConfig
func (*PostgresRepository) Delete ¶
func (r *PostgresRepository) Delete(id int64) error
Delete use to retrieve an externalConfig by name
func (*PostgresRepository) Get ¶
func (r *PostgresRepository) Get(id int64) (models.ExternalConfig, bool, error)
Get use to retrieve an externalConfig by id
func (*PostgresRepository) GetAll ¶
func (r *PostgresRepository) GetAll() (map[int64]models.ExternalConfig, error)
GetAll method used to get all externalConfigs
func (*PostgresRepository) GetByName ¶ added in v5.0.9
func (r *PostgresRepository) GetByName(name string) (models.ExternalConfig, bool, error)
GetByName use to retrieve an externalConfig by name
func (*PostgresRepository) Update ¶
func (r *PostgresRepository) Update(id int64, externalConfig models.ExternalConfig) error
Update method used to update un externalConfig
type Repository ¶
type Repository interface { Get(id int64) (models.ExternalConfig, bool, error) GetByName(name string) (models.ExternalConfig, bool, error) Create(rootCause models.ExternalConfig) (int64, error) Update(id int64, rootCause models.ExternalConfig) error Delete(id int64) error GetAll() (map[int64]models.ExternalConfig, 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 ExternalConfigs
func NewPostgresRepository ¶
func NewPostgresRepository(dbClient *sqlx.DB) Repository
NewPostgresRepository returns a new instance of PostgresRepository