entities

package
v0.0.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is the error returned, if the entity is not found in the DB.
	ErrNotFound = errors.New("Not found")

	// ErrConflict is the error returned, if the adding or updating an entity
	// causes a conflict with an existing entity.
	ErrConflict = errors.New("Conflict")
)
View Source
var PreparedStmts = map[int]*sql.Stmt{}

PreparedStmts is a placeholder for transitioning to package-scoped transaction functions.

Functions

func BatchExists

func BatchExists(ctx context.Context, db dbtx, name string) (_ bool, _err error)

BatchExists checks if a batch with the given key exists. generator: batch Exists

func CreateBatch

func CreateBatch(ctx context.Context, db dbtx, object migration.Batch) (_ int64, _err error)

CreateBatch adds a new batch to the database. generator: batch Create

func CreateInstance

func CreateInstance(ctx context.Context, db dbtx, object migration.Instance) (_ int64, _err error)

CreateInstance adds a new instance to the database. generator: instance Create

func CreateInstanceOverride

func CreateInstanceOverride(ctx context.Context, db dbtx, object migration.InstanceOverride) (_ int64, _err error)

CreateInstanceOverride adds a new instance_override to the database. generator: instance_override Create

func CreateNetwork

func CreateNetwork(ctx context.Context, db dbtx, object migration.Network) (_ int64, _err error)

CreateNetwork adds a new network to the database. generator: network Create

func CreateSource

func CreateSource(ctx context.Context, db dbtx, object migration.Source) (_ int64, _err error)

CreateSource adds a new source to the database. generator: source Create

func CreateTarget

func CreateTarget(ctx context.Context, db dbtx, object migration.Target) (_ int64, _err error)

CreateTarget adds a new target to the database. generator: target Create

func DeleteBatch

func DeleteBatch(ctx context.Context, db dbtx, name string) (_err error)

DeleteBatch deletes the batch matching the given key parameters. generator: batch DeleteOne-by-Name

func DeleteInstance

func DeleteInstance(ctx context.Context, db dbtx, uuid uuid.UUID) (_err error)

DeleteInstance deletes the instance matching the given key parameters. generator: instance DeleteOne-by-UUID

func DeleteInstanceOverride

func DeleteInstanceOverride(ctx context.Context, db dbtx, uuid uuid.UUID) (_err error)

DeleteInstanceOverride deletes the instance_override matching the given key parameters. generator: instance_override DeleteOne-by-UUID

func DeleteNetwork

func DeleteNetwork(ctx context.Context, db dbtx, name string) (_err error)

DeleteNetwork deletes the network matching the given key parameters. generator: network DeleteOne-by-Name

func DeleteSource

func DeleteSource(ctx context.Context, db dbtx, name string) (_err error)

DeleteSource deletes the source matching the given key parameters. generator: source DeleteOne-by-Name

func DeleteTarget

func DeleteTarget(ctx context.Context, db dbtx, name string) (_err error)

DeleteTarget deletes the target matching the given key parameters. generator: target DeleteOne-by-Name

func GetBatch

func GetBatch(ctx context.Context, db dbtx, name string) (_ *migration.Batch, _err error)

GetBatch returns the batch with the given key. generator: batch GetOne

func GetBatchID

func GetBatchID(ctx context.Context, db tx, name string) (_ int64, _err error)

GetBatchID return the ID of the batch with the given key. generator: batch ID

func GetBatchNames

func GetBatchNames(ctx context.Context, db dbtx, filters ...BatchFilter) (_ []string, _err error)

GetBatchNames returns the identifying field of batch. generator: batch GetNames

func GetBatches

func GetBatches(ctx context.Context, db dbtx, filters ...BatchFilter) (_ []migration.Batch, _err error)

GetBatches returns all available batches. generator: batch GetMany

func GetInstance

func GetInstance(ctx context.Context, db dbtx, uuid uuid.UUID) (_ *migration.Instance, _err error)

GetInstance returns the instance with the given key. generator: instance GetOne

func GetInstanceID

func GetInstanceID(ctx context.Context, db tx, uuid uuid.UUID) (_ int64, _err error)

GetInstanceID return the ID of the instance with the given key. generator: instance ID

func GetInstanceNames

func GetInstanceNames(ctx context.Context, db dbtx, filters ...InstanceFilter) (_ []uuid.UUID, _err error)

GetInstanceNames returns the identifying field of instance. generator: instance GetNames

func GetInstanceOverride

func GetInstanceOverride(ctx context.Context, db dbtx, uuid uuid.UUID) (_ *migration.InstanceOverride, _err error)

GetInstanceOverride returns the instance_override with the given key. generator: instance_override GetOne

func GetInstanceOverrideID

func GetInstanceOverrideID(ctx context.Context, db tx, uuid uuid.UUID) (_ int64, _err error)

GetInstanceOverrideID return the ID of the instance_override with the given key. generator: instance_override ID

func GetInstanceOverrides

func GetInstanceOverrides(ctx context.Context, db dbtx, filters ...InstanceOverrideFilter) (_ []migration.InstanceOverride, _err error)

GetInstanceOverrides returns all available instance_overrides. generator: instance_override GetMany

func GetInstances

func GetInstances(ctx context.Context, db dbtx, filters ...InstanceFilter) (_ []migration.Instance, _err error)

GetInstances returns all available instances. generator: instance GetMany

func GetNetwork

func GetNetwork(ctx context.Context, db dbtx, name string) (_ *migration.Network, _err error)

GetNetwork returns the network with the given key. generator: network GetOne

func GetNetworkID

func GetNetworkID(ctx context.Context, db tx, name string) (_ int64, _err error)

GetNetworkID return the ID of the network with the given key. generator: network ID

func GetNetworkNames

func GetNetworkNames(ctx context.Context, db dbtx, filters ...NetworkFilter) (_ []string, _err error)

GetNetworkNames returns the identifying field of network. generator: network GetNames

func GetNetworks

func GetNetworks(ctx context.Context, db dbtx, filters ...NetworkFilter) (_ []migration.Network, _err error)

GetNetworks returns all available networks. generator: network GetMany

func GetSource

func GetSource(ctx context.Context, db dbtx, name string) (_ *migration.Source, _err error)

GetSource returns the source with the given key. generator: source GetOne

func GetSourceID

func GetSourceID(ctx context.Context, db tx, name string) (_ int64, _err error)

GetSourceID return the ID of the source with the given key. generator: source ID

func GetSourceNames

func GetSourceNames(ctx context.Context, db dbtx, filters ...SourceFilter) (_ []string, _err error)

GetSourceNames returns the identifying field of source. generator: source GetNames

func GetSources

func GetSources(ctx context.Context, db dbtx, filters ...SourceFilter) (_ []migration.Source, _err error)

GetSources returns all available sources. generator: source GetMany

func GetTarget

func GetTarget(ctx context.Context, db dbtx, name string) (_ *migration.Target, _err error)

GetTarget returns the target with the given key. generator: target GetOne

func GetTargetID

func GetTargetID(ctx context.Context, db tx, name string) (_ int64, _err error)

GetTargetID return the ID of the target with the given key. generator: target ID

func GetTargetNames

func GetTargetNames(ctx context.Context, db dbtx, filters ...TargetFilter) (_ []string, _err error)

GetTargetNames returns the identifying field of target. generator: target GetNames

func GetTargets

func GetTargets(ctx context.Context, db dbtx, filters ...TargetFilter) (_ []migration.Target, _err error)

GetTargets returns all available targets. generator: target GetMany

func NetworkExists

func NetworkExists(ctx context.Context, db dbtx, name string) (_ bool, _err error)

NetworkExists checks if a network with the given key exists. generator: network Exists

func PrepareStmts

func PrepareStmts(db preparer, skipErrors bool) (map[int]*sql.Stmt, error)

PrepareStmts prepares all registered statements and returns an index from statement code to prepared statement object.

func RegisterStmt

func RegisterStmt(sqlStmt string) int

RegisterStmt register a SQL statement.

Registered statements will be prepared upfront and reused, to speed up execution.

Return a unique registration code.

func RenameBatch

func RenameBatch(ctx context.Context, db dbtx, name string, to string) (_err error)

RenameBatch renames the batch matching the given key parameters. generator: batch Rename

func RenameNetwork

func RenameNetwork(ctx context.Context, db dbtx, name string, to string) (_err error)

RenameNetwork renames the network matching the given key parameters. generator: network Rename

func RenameSource

func RenameSource(ctx context.Context, db dbtx, name string, to string) (_err error)

RenameSource renames the source matching the given key parameters. generator: source Rename

func RenameTarget

func RenameTarget(ctx context.Context, db dbtx, name string, to string) (_err error)

RenameTarget renames the target matching the given key parameters. generator: target Rename

func SourceExists

func SourceExists(ctx context.Context, db dbtx, name string) (_ bool, _err error)

SourceExists checks if a source with the given key exists. generator: source Exists

func Stmt

func Stmt(db dbtx, code int) (*sql.Stmt, error)

Stmt prepares the in-memory prepared statement for the transaction.

func StmtString

func StmtString(code int) (string, error)

StmtString returns the in-memory query string with the given code.

func TargetExists

func TargetExists(ctx context.Context, db dbtx, name string) (_ bool, _err error)

TargetExists checks if a target with the given key exists. generator: target Exists

func UpdateBatch

func UpdateBatch(ctx context.Context, db tx, name string, object migration.Batch) (_err error)

UpdateBatch updates the batch matching the given key parameters. generator: batch Update

func UpdateInstance

func UpdateInstance(ctx context.Context, db tx, uuid uuid.UUID, object migration.Instance) (_err error)

UpdateInstance updates the instance matching the given key parameters. generator: instance Update

func UpdateInstanceOverride

func UpdateInstanceOverride(ctx context.Context, db tx, uuid uuid.UUID, object migration.InstanceOverride) (_err error)

UpdateInstanceOverride updates the instance_override matching the given key parameters. generator: instance_override Update

func UpdateNetwork

func UpdateNetwork(ctx context.Context, db tx, name string, object migration.Network) (_err error)

UpdateNetwork updates the network matching the given key parameters. generator: network Update

func UpdateSource

func UpdateSource(ctx context.Context, db tx, name string, object migration.Source) (_err error)

UpdateSource updates the source matching the given key parameters. generator: source Update

func UpdateTarget

func UpdateTarget(ctx context.Context, db tx, name string, object migration.Target) (_err error)

UpdateTarget updates the target matching the given key parameters. generator: target Update

Types

type BatchFilter

type BatchFilter struct {
	Name   *string
	Status *api.BatchStatusType
}

type InstanceFilter

type InstanceFilter struct {
	UUID            *uuid.UUID
	Batch           *string
	MigrationStatus *api.MigrationStatusType
	Source          *string
}

type InstanceOverrideFilter

type InstanceOverrideFilter struct {
	UUID *uuid.UUID
}

type Marshaler

type Marshaler interface {
	MarshalDB() (string, error)
}

Marshaler is the interface that wraps the MarshalDB method, which converts the underlying type into a string representation suitable for persistence in the database.

type NetworkFilter

type NetworkFilter struct {
	Name *string
}

type SourceFilter

type SourceFilter struct {
	Name *string
}

type TargetFilter

type TargetFilter struct {
	Name *string
}

type Unmarshaler

type Unmarshaler interface {
	UnmarshalDB(string) error
}

Unmarshaler is the interface that wraps the UnmarshalDB method, which converts a string representation retrieved from the database into the underlying type.

Jump to

Keyboard shortcuts

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