db

package
v0.0.0-...-fd19b33 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AffectedRowsMismatchError = errors.New("Unexpected affected rows")
View Source
var BlueprintNotFoundError = errors.New("blueprint not found")
View Source
var CloneNotFoundError = errors.New("Clone not found")
View Source
var ComposeEntryNotFoundError = errors.New("Compose entry not found")

ComposeEntryNotFoundError 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
}

type BlueprintWithNoBody

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

type CloneEntry

type CloneEntry struct {
	Id        uuid.UUID
	ComposeId uuid.UUID
	Request   json.RawMessage
	CreatedAt time.Time
}

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

	InsertClone(ctx context.Context, composeId, cloneId uuid.UUID, request json.RawMessage) error
	GetClonesForCompose(ctx context.Context, composeId uuid.UUID, orgId string, limit, offset int) ([]CloneEntry, int, error)
	GetClone(ctx context.Context, id uuid.UUID, orgId string) (*CloneEntry, error)

	InsertBlueprint(ctx context.Context, id uuid.UUID, versionId uuid.UUID, orgID, accountNumber, name, description string, body json.RawMessage, metadata 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) 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, accountNumber string) error
}

func InitDBConnectionPool

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

Jump to

Keyboard shortcuts

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