entities

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: Apache-2.0 Imports: 12 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 ArtifactExists

func ArtifactExists(ctx context.Context, db dbtx, uuid uuid.UUID) (_ bool, _err error)

ArtifactExists checks if a artifact with the given key exists. generator: artifact Exists

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 CreateArtifact

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

CreateArtifact adds a new artifact to the database. generator: artifact Create

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 CreateInstanceBatches

func CreateInstanceBatches(ctx context.Context, db tx, objects []InstanceBatch) (_err error)

CreateInstanceBatches adds a new instance_batch to the database. generator: instance_batch Create

func CreateMigrationWindow

func CreateMigrationWindow(ctx context.Context, db dbtx, object MigrationWindow) (_ int64, _err error)

CreateMigrationWindow adds a new migration_window to the database. generator: migration_window 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 CreateOrReplaceWarning

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

CreateOrReplaceWarning adds a new warning to the database. generator: warning CreateOrReplace

func CreateQueueEntry

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

CreateQueueEntry adds a new queue_entry to the database. generator: queue_entry 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 DeleteArtifact

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

DeleteArtifact deletes the artifact matching the given key parameters. generator: artifact DeleteOne-by-UUID

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 DeleteInstanceBatch

func DeleteInstanceBatch(ctx context.Context, db tx, instanceID int, batchID int) (_err error)

DeleteInstanceBatch deletes the instance_batch matching the given key parameters.

func DeleteInstanceBatches

func DeleteInstanceBatches(ctx context.Context, db tx, instanceID int) (_err error)

DeleteInstanceBatches deletes the instance_batch matching the given key parameters. generator: instance_batch DeleteMany

func DeleteMigrationWindow

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

DeleteMigrationWindow deletes the migration_window matching the given key parameters. generator: migration_window DeleteOne-by-Name-and-Batch

func DeleteNetwork

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

DeleteNetwork deletes the network matching the given key parameters. generator: network DeleteOne-by-SourceSpecificID-and-Source

func DeleteQueueEntries

func DeleteQueueEntries(ctx context.Context, db dbtx, batchName string) (_err error)

DeleteQueueEntries deletes the queue_entry matching the given key parameters. generator: queue_entry DeleteMany-by-BatchName

func DeleteQueueEntry

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

DeleteQueueEntry deletes the queue_entry matching the given key parameters. generator: queue_entry DeleteOne-by-InstanceUUID

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 DeleteWarning

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

DeleteWarning deletes the warning matching the given key parameters. generator: warning DeleteOne-by-UUID

func GetArtifact

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

GetArtifact returns the artifact with the given key. generator: artifact GetOne

func GetArtifactID

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

GetArtifactID return the ID of the artifact with the given key. generator: artifact ID

func GetArtifacts

func GetArtifacts(ctx context.Context, db dbtx, filters ...ArtifactFilter) (_ []migration.Artifact, _err error)

GetArtifacts returns all available artifacts. generator: artifact GetMany

func GetAssignedInstances

func GetAssignedInstances(ctx context.Context, tx dbtx) (migration.Instances, error)

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 GetBatchInstances

func GetBatchInstances(ctx context.Context, db tx, batchID int) (_ []migration.Instance, _err error)

GetBatchInstances returns all available Instances for the Batch. generator: instance_batch GetMany

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 GetBatchesByInstance

func GetBatchesByInstance(ctx context.Context, tx dbtx, instanceUUID *uuid.UUID) (migration.Batches, error)

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 GetInstanceBatches

func GetInstanceBatches(ctx context.Context, db tx, instanceID int) (_ []migration.Batch, _err error)

GetInstanceBatches returns all available Batches for the Instance. generator: instance_batch GetMany

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 GetInstances

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

GetInstances returns all available instances. generator: instance GetMany

func GetInstancesByBatch

func GetInstancesByBatch(ctx context.Context, tx dbtx, batchName *string) (migration.Instances, error)

func GetMigrationWindowID

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

GetMigrationWindowID return the ID of the migration_window with the given key. generator: migration_window ID

func GetNetwork

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

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

func GetNetworkByUUID

func GetNetworkByUUID(ctx context.Context, db dbtx, id uuid.UUID) (_ *migration.Network, _err error)

GetNetworkByUUID returns the network with the given UUID.

func GetNetworkID

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

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

func GetNetworks

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

GetNetworks returns all available networks. generator: network GetMany

func GetQueueEntries

func GetQueueEntries(ctx context.Context, db dbtx, filters ...QueueEntryFilter) (_ []migration.QueueEntry, _err error)

GetQueueEntries returns all available queue_entries. generator: queue_entry GetMany

func GetQueueEntry

func GetQueueEntry(ctx context.Context, db dbtx, instanceUUID uuid.UUID) (_ *migration.QueueEntry, _err error)

GetQueueEntry returns the queue_entry with the given key. generator: queue_entry GetOne

func GetQueueEntryID

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

GetQueueEntryID return the ID of the queue_entry with the given key. generator: queue_entry ID

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 GetWarning

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

GetWarning returns the warning with the given key. generator: warning GetOne

func GetWarningID

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

GetWarningID return the ID of the warning with the given key. generator: warning ID

func GetWarnings

func GetWarnings(ctx context.Context, db dbtx, filters ...WarningFilter) (_ []migration.Warning, _err error)

GetWarnings returns all available warnings. generator: warning GetMany

func NetworkExists

func NetworkExists(ctx context.Context, db dbtx, sourceSpecificID string, source 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 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 UpdateArtifact

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

UpdateArtifact updates the artifact matching the given key parameters. generator: artifact Update

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 UpdateMigrationWindow

func UpdateMigrationWindow(ctx context.Context, db tx, name string, batch string, object MigrationWindow) (_err error)

UpdateMigrationWindow updates the migration_window matching the given key parameters. generator: migration_window Update

func UpdateNetwork

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

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

func UpdateQueueEntry

func UpdateQueueEntry(ctx context.Context, db tx, instanceUUID uuid.UUID, object migration.QueueEntry) (_err error)

UpdateQueueEntry updates the queue_entry matching the given key parameters. generator: queue_entry 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

func UpdateWarning

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

UpdateWarning updates the warning matching the given key parameters. generator: warning Update

Types

type ArtifactFilter

type ArtifactFilter struct {
	ID   *int64
	UUID *uuid.UUID
	Type *api.ArtifactType
}

type BatchFilter

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

type InstanceBatch

type InstanceBatch struct {
	BatchID    int64 `db:"primary=yes"`
	InstanceID int64 `db:"primary=yes"`
}

type InstanceBatchFilter

type InstanceBatchFilter struct {
	BatchID    *int64
	InstanceID *int64
}

type InstanceFilter

type InstanceFilter struct {
	ID     *int64
	UUID   *uuid.UUID
	Source *string
}

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 MigrationWindow

type MigrationWindow = migration.Window

func GetMigrationWindow

func GetMigrationWindow(ctx context.Context, db dbtx, name string, batch string) (_ *MigrationWindow, _err error)

GetMigrationWindow returns the migration_window with the given key. generator: migration_window GetOne

func GetMigrationWindows

func GetMigrationWindows(ctx context.Context, db dbtx, filters ...MigrationWindowFilter) (_ []MigrationWindow, _err error)

GetMigrationWindows returns all available migration_windows. generator: migration_window GetMany

type MigrationWindowFilter

type MigrationWindowFilter struct {
	ID    *int64
	Name  *string
	Batch *string
}

type NetworkFilter

type NetworkFilter struct {
	SourceSpecificID *string
	Source           *string
	UUID             *uuid.UUID
}

type QueueEntryFilter

type QueueEntryFilter struct {
	InstanceUUID    *uuid.UUID
	BatchName       *string
	MigrationStatus *api.MigrationStatusType
	ImportStage     *migration.ImportStage
}

type SourceFilter

type SourceFilter struct {
	SourceType *api.SourceType
	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.

type WarningFilter

type WarningFilter struct {
	ID         *int64
	UUID       *uuid.UUID
	Scope      *string
	EntityType *string
	Entity     *string
	Type       *api.WarningType
}

Jump to

Keyboard shortcuts

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