db

package
v0.0.0-...-77ecf1e Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAffectedRowsMismatch = errors.New("unexpected affected rows")
View Source
var ErrBlueprintNotFound = errors.New("blueprint not found")
View Source
var ErrComposeEntryNotFound = errors.New("compose entry not found")

ErrComposeEntryNotFound occurs when no compose request is found for a user.

Functions

This section is empty.

Types

type BlueprintCompose

type BlueprintCompose struct {
	ComposeEntry
	BlueprintId      uuid.UUID
	BlueprintVersion int
}

type BlueprintEntry

type BlueprintEntry struct {
	Id               uuid.UUID
	VersionId        uuid.UUID
	Version          int
	Body             json.RawMessage
	Name             string
	Description      string
	Metadata         json.RawMessage
	ServiceSnapshots json.RawMessage
}

type BlueprintWithNoBody

type BlueprintWithNoBody struct {
	Id             uuid.UUID
	Version        int
	Name           string
	Description    string
	LastModifiedAt time.Time
}

type ComplianceSnapshot

type ComplianceSnapshot struct {
	PolicyId             uuid.UUID       `json:"policy_id"`
	PolicyCustomizations json.RawMessage `json:"policy_customizations"`
}

type ComposeEntry

type ComposeEntry struct {
	Id        uuid.UUID
	Request   json.RawMessage
	CreatedAt time.Time
	ImageName *string
	ClientId  *string
}

type ComposeWithBlueprintVersion

type ComposeWithBlueprintVersion struct {
	*ComposeEntry
	BlueprintId      *uuid.UUID
	BlueprintVersion *int
}

type DB

type DB interface {
	InsertCompose(ctx context.Context, jobId uuid.UUID, accountNumber, email, orgId string, imageName *string, request json.RawMessage, clientId *string, blueprintVersionId *uuid.UUID) error
	GetComposes(ctx context.Context, orgId string, since time.Duration, limit, offset int, ignoreImageTypes []string) ([]ComposeWithBlueprintVersion, int, error)
	GetLatestBlueprintVersionNumber(ctx context.Context, orgId string, blueprintId uuid.UUID) (int, error)
	GetBlueprintComposes(ctx context.Context, orgId string, blueprintId uuid.UUID, blueprintVersion *int, since time.Duration, limit, offset int, ignoreImageTypes []string) ([]BlueprintCompose, error)
	GetCompose(ctx context.Context, jobId uuid.UUID, orgId string) (*ComposeEntry, error)
	GetComposeImageType(ctx context.Context, jobId uuid.UUID, orgId string) (string, error)
	CountComposesSince(ctx context.Context, orgId string, duration time.Duration) (int, error)
	CountBlueprintComposesSince(ctx context.Context, orgId string, blueprintId uuid.UUID, blueprintVersion *int, since time.Duration, ignoreImageTypes []string) (int, error)
	DeleteCompose(ctx context.Context, jobId uuid.UUID, orgId string) error

	InsertBlueprint(ctx context.Context, id uuid.UUID, versionId uuid.UUID, orgID, accountNumber, name, description string, body json.RawMessage, metadata json.RawMessage, serviceSnapshots json.RawMessage) error
	GetBlueprint(ctx context.Context, id uuid.UUID, orgID string, version *int) (*BlueprintEntry, error)
	UpdateBlueprint(ctx context.Context, id uuid.UUID, blueprintId uuid.UUID, orgId string, name string, description string, body json.RawMessage, serviceSnapshots json.RawMessage) error
	GetBlueprints(ctx context.Context, orgID string, limit, offset int) ([]BlueprintWithNoBody, int, error)
	FindBlueprints(ctx context.Context, orgID, search string, limit, offset int) ([]BlueprintWithNoBody, int, error)
	FindBlueprintByName(ctx context.Context, orgID, nameQuery string) (*BlueprintWithNoBody, error)
	DeleteBlueprint(ctx context.Context, id uuid.UUID, orgID string) error
}

func InitDBConnectionPool

func InitDBConnectionPool(ctx context.Context, connStr string) (DB, error)

type ServiceSnapshots

type ServiceSnapshots struct {
	Compliance *ComplianceSnapshot `json:"compliance,omitempty"`
}

Jump to

Keyboard shortcuts

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