storage

package
v0.0.0-...-bb536ff Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiKeyEntity

type ApiKeyEntity struct {
	Id       string `db:"id"`
	Username string `db:"username"`
	Name     string `db:"name"`
}

type ApiKeyRepository

type ApiKeyRepository interface {
	CrudRepository[ApiKeyEntity, string]
	GetByUsername(username string) ([]ApiKeyEntity, error)
}

type ContainerRegistryEntity

type ContainerRegistryEntity struct {
	Id        int    `db:"id"`
	ProjectId string `db:"project_id"`
	Url       string `db:"url"`
	Username  string `db:"username"`
	Password  string `db:"password"`
}

type ContainerRegistryRepository

type ContainerRegistryRepository interface {
	FindByProjectId(projectId string) ([]ContainerRegistryEntity, error)
	CreateNew(registry ContainerRegistryEntity) (int, error)
	ExistsByProjectIdAndUrl(projectId string, url string) (bool, error)
	Delete(id int) error
}

type CrudRepository

type CrudRepository[T any, ID any] interface {
	CreateNew(record T) (ID, error)
	ExistsByID(id ID) (bool, error)
	FindByID(id ID) (*T, error)
	Update(record T) error
	Delete(id ID) error
}

type EnvVarEntity

type EnvVarEntity struct {
	Name   string  `json:"name"`
	Value  *string `json:"value"`
	Secret *string `json:"secret"`
}

type EnvVars

type EnvVars []EnvVarEntity

func (*EnvVars) Scan

func (ev *EnvVars) Scan(value interface{}) error

func (*EnvVars) Value

func (ev *EnvVars) Value() (driver.Value, error)

type ManagedServiceEntity

type ManagedServiceEntity struct {
	Id        int    `db:"id"`
	ProjectId string `db:"project_id"`
	Name      string `db:"name"`
	Type      string `db:"type"`
}

type ManagedServiceRepository

type ManagedServiceRepository interface {
	CrudRepository[ManagedServiceEntity, int]
	FindAll(limit int, offset int) ([]ManagedServiceEntity, error)
	FindByProjectId(projectId string) ([]ManagedServiceEntity, error)
	ExistsByNameAndProjectId(name string, projectId string) (bool, error)
}

type ProjectEntity

type ProjectEntity struct {
	Id         string `db:"id"`
	InviteCode string `db:"invite_code"`
}

type ProjectRepository

type ProjectRepository interface {
	CrudRepository[ProjectEntity, string]
	FindAll(limit int, offset int) ([]ProjectEntity, error)
	FindUserProjects(username string) ([]ProjectEntity, error)
	GetParticipants(id string) ([]string, error)
	IsParticipant(id string, username string) (bool, error)
	AddParticipant(id string, username string) error
	RemoveParticipant(id string, username string) error
	FindByInviteCode(code string) (*ProjectEntity, error)
}

type QueryExecDB

type QueryExecDB interface {
	sqlx.Execer
	sqlx.Queryer
	sqlx.ExecerContext
	sqlx.QueryerContext
	Select(dest interface{}, query string, args ...interface{}) error
	Get(dest interface{}, query string, args ...interface{}) error
	NamedExec(query string, args interface{}) (sql.Result, error)
	NamedQuery(query string, args interface{}) (*sqlx.Rows, error)
}

type SecretEntity

type SecretEntity struct {
	Id               int    `db:"id"`
	ProjectId        string `db:"project_id"`
	Name             string `db:"name"`
	Value            string `db:"value"`
	ManagedServiceId *int   `db:"managed_service_id"`
}

type SecretRepository

type SecretRepository interface {
	FindByProjectId(id string) ([]SecretEntity, error)
	CreateNew(secret SecretEntity) error
	ExistsByProjectIdAndName(id string, name string) (bool, error)
	FindByProjectIdAndName(id string, name string) (*SecretEntity, error)
	DeleteByProjectIdAndName(id string, name string) error
}

type ServiceEntity

type ServiceEntity struct {
	Id              int            `db:"id"`
	ProjectId       string         `db:"project_id"`
	Name            string         `db:"name"`
	Image           string         `db:"image"`
	Port            int            `db:"port"`
	PublicApiPrefix sql.NullString `db:"public_api_prefix"`
	StripApiPrefix  bool           `db:"strip_api_prefix"`
	EnvVars         EnvVars        `db:"env_vars"`
	Replicas        int            `db:"replicas"`
}

type ServiceRepository

type ServiceRepository interface {
	CrudRepository[ServiceEntity, int]
	FindAll(limit int, offset int) ([]ServiceEntity, error)
	FindByProjectId(projectId string) ([]ServiceEntity, error)
	ExistsByNameAndProjectId(name string, projectId string) (bool, error)
}

type Storage

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

func New

func New(db *sqlx.DB) *Storage

func (*Storage) ApiKeyRepository

func (s *Storage) ApiKeyRepository() ApiKeyRepository

func (*Storage) ContainerRegistryRepository

func (s *Storage) ContainerRegistryRepository() ContainerRegistryRepository

func (*Storage) ExecTx

func (s *Storage) ExecTx(ctx context.Context, f func(*Storage) error) error

func (*Storage) ManagedServiceRepository

func (s *Storage) ManagedServiceRepository() ManagedServiceRepository

func (*Storage) ProjectRepository

func (s *Storage) ProjectRepository() ProjectRepository

func (*Storage) SecretRepository

func (s *Storage) SecretRepository() SecretRepository

func (*Storage) ServiceRepository

func (s *Storage) ServiceRepository() ServiceRepository

Jump to

Keyboard shortcuts

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