db

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRollback = errors.New("rollback tx")
View Source
var FactoryMap = make(map[string]Factory)

Functions

func WithTx

func WithTx(ctx context.Context, db DB, fn func(Tx) error) error

Types

type AppsDB

type AppsDB interface {
	CreateApp(ctx context.Context, app *models.App) error
	GetApp(ctx context.Context, id string) (*models.App, error)
	ListApps(ctx context.Context, credentialIDs []models.CredentialID) ([]*models.App, error)
	UpdateAppConfig(ctx context.Context, app *models.App) error
}

type CertStorage

type CertStorage struct {
	DB DB
	// contains filtered or unexported fields
}

func NewCertStorage

func NewCertStorage(db DB, pass string) *CertStorage

func (*CertStorage) Delete

func (s *CertStorage) Delete(ctx context.Context, key string) error

func (*CertStorage) Exists

func (s *CertStorage) Exists(ctx context.Context, key string) bool

func (*CertStorage) List

func (s *CertStorage) List(ctx context.Context, prefix string, recursive bool) ([]string, error)

func (*CertStorage) Load

func (s *CertStorage) Load(ctx context.Context, key string) ([]byte, error)

func (*CertStorage) Lock

func (s *CertStorage) Lock(ctx context.Context, name string) error

func (*CertStorage) Stat

func (s *CertStorage) Stat(ctx context.Context, key string) (certmagic.KeyInfo, error)

func (*CertStorage) Store

func (s *CertStorage) Store(ctx context.Context, key string, value []byte) error

func (*CertStorage) Unlock

func (s *CertStorage) Unlock(ctx context.Context, name string) error

type CertificateDB

type CertificateDB interface {
	GetCertDataEntry(ctx context.Context, key string) (*models.CertDataEntry, error)
	SetCertDataEntry(ctx context.Context, entry *models.CertDataEntry) error
	DeleteCertificateData(ctx context.Context, key string) error
	ListCertificateData(ctx context.Context, prefix string) ([]string, error)
}

type DB

type DB interface {
	BeginTx(ctx context.Context) (Tx, error)
	Locker(ctx context.Context) (LockerDB, error)
	DBQuery
}

func New

func New(url string) (DB, error)

type DeploymentInfo

type DeploymentInfo struct {
	*models.Deployment
	FirstSiteName *string `db:"site_name"`
}

type DeploymentsDB

type DeploymentsDB interface {
	CreateDeployment(ctx context.Context, deployment *models.Deployment) error
	GetDeployment(ctx context.Context, appID string, id string) (*models.Deployment, error)
	GetDeploymentByName(ctx context.Context, appID string, name string) (*models.Deployment, error)
	ListDeployments(ctx context.Context, appID string) ([]DeploymentInfo, error)
	MarkDeploymentUploaded(ctx context.Context, now time.Time, deployment *models.Deployment) error
	GetSiteDeployment(ctx context.Context, appID string, siteName string) (*models.Deployment, error)
	GetDeploymentSiteNames(ctx context.Context, deployment *models.Deployment) ([]string, error)
	SetDeploymentExpiry(ctx context.Context, deployment *models.Deployment) error
	DeleteExpiredDeployments(ctx context.Context, now time.Time, expireBefore time.Time) (int64, error)
}

type DomainsDB added in v0.5.0

type DomainsDB interface {
	CreateDomain(ctx context.Context, domain *models.Domain) error
	GetDomainByName(ctx context.Context, domain string) (*models.Domain, error)
	GetDomainBySite(ctx context.Context, appID string, siteName string) (*models.Domain, error)
	DeleteDomain(ctx context.Context, id string, now time.Time) error
	ListDomains(ctx context.Context, appID string) ([]*models.Domain, error)
}

type Factory

type Factory func(url neturl.URL) (DB, error)

type LockerDB

type LockerDB interface {
	Close() error
	Lock(ctx context.Context, name string) error
	Unlock(ctx context.Context, name string) error
}

type SiteInfo

type SiteInfo struct {
	*models.Site
	DeploymentName *string `db:"deployment_name"`
}

type SitesDB

type SitesDB interface {
	CreateSiteIfNotExist(ctx context.Context, site *models.Site) (*SiteInfo, error)
	GetSiteByName(ctx context.Context, appID string, siteName string) (*models.Site, error)
	GetSiteInfo(ctx context.Context, appID string, id string) (*SiteInfo, error)
	ListSitesInfo(ctx context.Context, appID string) ([]SiteInfo, error)
	SetSiteDeployment(ctx context.Context, site *models.Site) error
}

type Tx

type Tx interface {
	Rollback() error
	Commit() error
	DBQuery
}

type UserDB

type UserDB interface {
	GetUser(ctx context.Context, id string) (*models.User, error)
	GetCredential(ctx context.Context, id models.CredentialID) (*models.UserCredential, error)
	CreateUser(ctx context.Context, user *models.User) error
	AddCredential(ctx context.Context, credential *models.UserCredential) error
	UpdateCredentialData(ctx context.Context, cred *models.UserCredential) error
	ListCredentialIDs(ctx context.Context, userID string) ([]models.CredentialID, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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