externalconfig

package
v5.2.10 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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

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

func R

func R() Repository

R is used to access the global repository singleton

Jump to

Keyboard shortcuts

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