store

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthNotFound = authdom.ErrAuthNotFound

Backwards-compatible sentinel; prefer auth.ErrAuthNotFound

View Source
var ErrGlobalNotFound = errors.New("global not found")

ErrGlobalNotFound is returned when no global value is found.

Functions

This section is empty.

Types

type AuthsStore

type AuthsStore interface {
	// AddValueForAuth inserts a new value for an auth defined in the config.
	AddValueForAuth(ctx context.Context, name, description, value string) (*ValueForAuth, error)
	// DeleteValueForAuth deletes an added auth value.
	DeleteValueForAuth(ctx context.Context, id int64) (*ValueForAuth, error)
	// GetValuesForAuth returns all added values for a given auth from the config.
	GetValuesForAuth(ctx context.Context, name string) ([]*ValueForAuth, error)
	// UpdateAuthLastUsedAtToNow updates the last used at timestamp for a given auth value.
	// This is used to "select" the auth value to be used for an API request.
	UpdateAuthLastUsedAtToNow(ctx context.Context, id int64) error
	// GetLastUsedAuthByName returns the last used auth value for a given auth from the config.
	GetLastUsedAuthByName(ctx context.Context, name string) (*ValueForAuth, error)
}

type GlobalsStore

type GlobalsStore interface {
	// AddValueForGlobal inserts a new value for a global defined in the config.
	AddValueForGlobal(ctx context.Context, name, description, value string) (*ValueForGlobal, error)
	// DeleteValueForGlobal deletes an added global value.
	DeleteValueForGlobal(ctx context.Context, id int64) (*ValueForGlobal, error)
	// GetValuesForGlobal returns all added values for a given global from the config.
	GetValuesForGlobal(ctx context.Context, name string) ([]*ValueForGlobal, error)
	// UpdateGlobalLastUsedAtToNow updates the last used at timestamp for a given global value.
	// This is used to "select" the global value to be used for an API request.
	UpdateGlobalLastUsedAtToNow(ctx context.Context, id int64) error
	// GetLastUsedGlobalByName returns the last used global value for a given global from the config.
	GetLastUsedGlobalByName(ctx context.Context, name string) (*ValueForGlobal, error)
}

type Store

type Store interface {
	AuthsStore
	GlobalsStore
}

func New

func New(dataDir string) (Store, error)

type ValueForAuth

type ValueForAuth struct {
	ID          int64
	Name        string // identifies which auth this value is for
	Description string
	Value       string // the value of the auth
	CreatedAt   time.Time
	LastUsedAt  time.Time
}

func (*ValueForAuth) String

func (v *ValueForAuth) String(showName bool) string

String prints a one-line description of the auth value.

type ValueForGlobal

type ValueForGlobal struct {
	ID          int64
	Name        string // identifies which global this value is for
	Description string
	Value       string // the value of the global
	CreatedAt   time.Time
	LastUsedAt  time.Time
}

func (*ValueForGlobal) String

func (v *ValueForGlobal) String(showName bool) string

String prints a one-line description of the global value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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