Documentation
¶
Index ¶
- Constants
- Variables
- type Data
- type Database
- func (d *Database) CloseDB()
- func (d *Database) DB() *sql.DB
- func (d *Database) DeleteBundle(ctx context.Context, principal string, name string) error
- func (d *Database) DeleteSecret(ctx context.Context, principal string, name string) error
- func (d *Database) DeleteSource(ctx context.Context, principal string, name string) error
- func (d *Database) DeleteStack(ctx context.Context, principal string, name string) error
- func (d *Database) Dialect() (string, error)
- func (d *Database) GetBundle(ctx context.Context, principal string, name string) (*config.Bundle, error)
- func (db *Database) GetPrincipalID(ctx context.Context, apiKey string) (string, error)
- func (d *Database) GetSecret(ctx context.Context, principal string, name string) (*config.SecretRef, error)
- func (d *Database) GetSource(ctx context.Context, principal string, name string) (*config.Source, error)
- func (d *Database) GetStack(ctx context.Context, principal string, name string) (*config.Stack, error)
- func (d *Database) InitDB(ctx context.Context) error
- func (d *Database) ListBundles(ctx context.Context, principal string, opts ListOptions) ([]*config.Bundle, string, error)
- func (d *Database) ListSecrets(ctx context.Context, principal string, opts ListOptions) ([]*config.SecretRef, string, error)
- func (d *Database) ListSources(ctx context.Context, principal string, opts ListOptions) ([]*config.Source, string, error)
- func (d *Database) ListStacks(ctx context.Context, principal string, opts ListOptions) ([]*config.Stack, string, error)
- func (d *Database) LoadConfig(ctx context.Context, bar *progress.Bar, principal string, root *config.Root) error
- func (d *Database) QuerySourceData(sourceName string) func(context.Context) iter.Seq2[Data, error]
- func (d *Database) SourcesDataDelete(ctx context.Context, sourceName, path string, principal string) error
- func (d *Database) SourcesDataGet(ctx context.Context, sourceName, path string, principal string) (any, bool, error)
- func (d *Database) SourcesDataPatch(ctx context.Context, sourceName, path string, principal string, ...) error
- func (d *Database) SourcesDataPut(ctx context.Context, sourceName, path string, data any, principal string) error
- func (d *Database) UpsertBundle(ctx context.Context, principal string, bundle *config.Bundle) error
- func (db *Database) UpsertPrincipal(ctx context.Context, principal Principal) error
- func (db *Database) UpsertPrincipalTx(ctx context.Context, tx *sql.Tx, principal Principal) error
- func (d *Database) UpsertSecret(ctx context.Context, principal string, secret *config.Secret) error
- func (d *Database) UpsertSource(ctx context.Context, principal string, source *config.Source) error
- func (d *Database) UpsertStack(ctx context.Context, principal string, stack *config.Stack) error
- func (d *Database) UpsertToken(ctx context.Context, principal string, token *config.Token) error
- func (d *Database) WithConfig(config *config.Database) *Database
- func (d *Database) WithLogger(log *logging.Logger) *Database
- type ListOptions
- type Principal
Constants ¶
View Source
const SQLiteMemoryOnlyDSN = "file::memory:?cache=shared"
Variables ¶
View Source
var ErrNotAuthorized = errors.New("not authorized")
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database implements the database operations. It will hide any differences between the varying SQL databases from the rest of the codebase.
func (*Database) DeleteBundle ¶
func (*Database) DeleteSecret ¶
func (*Database) DeleteSource ¶
func (*Database) DeleteStack ¶
func (*Database) GetPrincipalID ¶
func (*Database) ListBundles ¶
func (*Database) ListSecrets ¶
func (*Database) ListSources ¶
func (d *Database) ListSources(ctx context.Context, principal string, opts ListOptions) ([]*config.Source, string, error)
ListSources returns a list of sources in the database. Note it does not return the source data.
func (*Database) ListStacks ¶
func (*Database) LoadConfig ¶
func (d *Database) LoadConfig(ctx context.Context, bar *progress.Bar, principal string, root *config.Root) error
LoadConfig loads the configuration from the configuration file into the database. Env vars for values are getting resolved at this point. We don't store "${ADMIN_TOKEN}" in the DB, but lookup the current field. Failing lookups are treated as errors! Secrets are the exception: they are stored as-is, so if their value refers to an env var, it's replaced on use.
func (*Database) QuerySourceData ¶
func (*Database) SourcesDataDelete ¶
func (*Database) SourcesDataGet ¶
func (*Database) SourcesDataPatch ¶
func (*Database) SourcesDataPut ¶
func (*Database) UpsertBundle ¶
func (*Database) UpsertPrincipal ¶
func (*Database) UpsertPrincipalTx ¶
func (*Database) UpsertSecret ¶
func (*Database) UpsertSource ¶
func (*Database) UpsertStack ¶
func (*Database) UpsertToken ¶
type ListOptions ¶
Click to show internal directories.
Click to hide internal directories.