Documentation ¶
Index ¶
- Variables
- func BindFlags(flags *pflag.FlagSet)
- func BindGoFlags()
- func CheckSummary(ctx context.Context, checkID string) (*models.CheckSummary, error)
- func DefaultGormConfig() *gorm.Config
- func Delete(ctx dutyContext.Context, model Table) error
- func GetComponent(ctx gocontext.Context, db *gorm.DB, id string) (*models.Component, error)
- func GetConfigMapFromCache(c kubernetes.Interface, namespace, name, key string) (string, error)
- func GetEnvStringFromCache(c kubernetes.Interface, env string, namespace string) (string, error)
- func GetEnvValueFromCache(c kubernetes.Interface, input types.EnvVar, namespace string) (string, error)
- func GetSecretFromCache(c kubernetes.Interface, namespace, name, key string) (string, error)
- func HasMigrationsRun(ctx context.Context, pool *pgxpool.Pool) (bool, error)
- func InitDB(connection string, migrateOpts *migrate.MigrateOptions) (*dutyContext.Context, error)
- func IsForeignKeyError(err error) bool
- func LookupComponents(ctx context.Context, lookup LookupSpec, labels map[string]string, ...) ([]uuid.UUID, error)
- func LookupConfigs(ctx context.Context, lookup LookupSpec, labels map[string]string, ...) ([]uuid.UUID, error)
- func Migrate(connection string, opts *migrate.MigrateOptions) error
- func NewDB(connection string) (*sql.DB, error)
- func NewGorm(connection string, config *gorm.Config) (*gorm.DB, error)
- func NewPgxPool(connection string) (*pgxpool.Pool, error)
- func Now() clause.Expr
- func QueryCheckSummary(ctx context.Context, dbpool *pgxpool.Pool, opts ...query.CheckSummaryOptions) ([]models.CheckSummary, error)
- func SetupDB(connection string, migrateOpts *migrate.MigrateOptions) (gormDB *gorm.DB, pgxpool *pgxpool.Pool, err error)
- type FindOption
- type Lookup
- type LookupEvalResult
- type LookupSpec
- type Table
- type TopologyOptions
- type TopologyResponse
Constants ¶
This section is empty.
Variables ¶
var DefaultQueryTimeout = 30 * time.Second
var LocalFilter = "deleted_at is NULL AND agent_id = '00000000-0000-0000-0000-000000000000' OR agent_id IS NULL"
var LogLevel string
LogLevel is the log level for gorm logger
Functions ¶
func BindGoFlags ¶ added in v1.0.310
func BindGoFlags()
func CheckSummary ¶ added in v1.0.164
deprecated use query.CheckSummaryByID
func DefaultGormConfig ¶ added in v1.0.6
func GetComponent ¶ added in v1.0.45
deprecated use query.GetComponent
func GetConfigMapFromCache ¶ added in v1.0.45
func GetConfigMapFromCache(c kubernetes.Interface, namespace, name, key string) (string, error)
deprecated use the methods in the context package
func GetEnvStringFromCache ¶ added in v1.0.45
deprecated use the methods in the context package
func GetEnvValueFromCache ¶ added in v1.0.45
func GetEnvValueFromCache(c kubernetes.Interface, input types.EnvVar, namespace string) (string, error)
deprecated use the methods in the context package
func GetSecretFromCache ¶ added in v1.0.45
func GetSecretFromCache(c kubernetes.Interface, namespace, name, key string) (string, error)
deprecated use the methods in the context package
func HasMigrationsRun ¶ added in v1.0.447
HasMigrationsRun performs a rudimentary check to see if the migrations have run at least once.
func InitDB ¶ added in v1.0.207
func InitDB(connection string, migrateOpts *migrate.MigrateOptions) (*dutyContext.Context, error)
func IsForeignKeyError ¶ added in v1.0.428
func LookupComponents ¶ added in v1.0.236
func LookupConfigs ¶ added in v1.0.236
func NewGorm ¶
creates a new Gorm DB connection using the global pgx connection pool, must be called after NewPgxPool
func QueryCheckSummary ¶ added in v1.0.34
func QueryCheckSummary(ctx context.Context, dbpool *pgxpool.Pool, opts ...query.CheckSummaryOptions) ([]models.CheckSummary, error)
deprecated use query.CheckSummary
Types ¶
type FindOption ¶ added in v1.0.253
func PickColumns ¶ added in v1.0.253
func PickColumns(columns ...string) FindOption
func WhereClause ¶ added in v1.0.287
func WhereClause(query any, args ...any) FindOption
type Lookup ¶ added in v1.0.236
type Lookup struct { // Expr is a cel-expression. Expr string `json:"expr,omitempty" yaml:"expr,omitempty"` // Value is the static value to use. Value string `json:"value,omitempty" yaml:"value,omitempty"` // Label specifies the key to lookup on the label. Label string `json:"label,omitempty" yaml:"label,omitempty"` }
Lookup specifies the type of lookup to perform.
type LookupEvalResult ¶ added in v1.0.236
LookupEvalResult is the result of evaluation of a LookupSpec.
type LookupSpec ¶ added in v1.0.236
type LookupSpec struct { Name Lookup `json:"name,omitempty" yaml:"name,omitempty"` Namespace Lookup `json:"namespace,omitempty" yaml:"namespace,omitempty"` Type Lookup `json:"type,omitempty" yaml:"type,omitempty"` }
LookupSpec defines a tuple of fields to lookup.
func (*LookupSpec) Eval ¶ added in v1.0.236
func (t *LookupSpec) Eval(labels map[string]string, envVar map[string]any) (*LookupEvalResult, error)
Eval evaluates all the fields in the lookup spec based on labels and environment variables. Returns nil if any non-empty lookup evaluates to an empty value.
type TopologyOptions ¶ added in v1.0.11
type TopologyOptions = query.TopologyOptions
type TopologyResponse ¶ added in v1.0.71
type TopologyResponse = query.TopologyResponse
func QueryTopology ¶ added in v1.0.24
func QueryTopology(ctx gocontext.Context, dbpool *pgxpool.Pool, params TopologyOptions) (*TopologyResponse, error)
deprecated use query.Topology
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
hack
|
|
migrate
Module
|
|
pkg
|
|
kube/labels
Package labels implements a simple label system, parsing and matching selectors with sets of labels.
|
Package labels implements a simple label system, parsing and matching selectors with sets of labels. |
tests
|
|