dao

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterStatusDao

type AdapterStatusDao interface {
	Get(ctx context.Context, id string) (*api.AdapterStatus, error)
	Create(ctx context.Context, adapterStatus *api.AdapterStatus) (*api.AdapterStatus, error)
	Upsert(ctx context.Context, adapterStatus *api.AdapterStatus, existing *api.AdapterStatus) (*api.AdapterStatus, error)
	Delete(ctx context.Context, id string) error
	DeleteByResource(ctx context.Context, resourceType, resourceID string) error
	FindByResource(ctx context.Context, resourceType, resourceID string) (api.AdapterStatusList, error)
	FindByResourceIDs(ctx context.Context, resourceType string, resourceIDs []string) (api.AdapterStatusList, error)
	FindByResourcePaginated(
		ctx context.Context, resourceType, resourceID string, offset, limit int,
	) (api.AdapterStatusList, int64, error)
	FindByResourceAndAdapter(
		ctx context.Context, resourceType, resourceID, adapter string,
	) (*api.AdapterStatus, error)
}

func NewAdapterStatusDao

func NewAdapterStatusDao(sessionFactory db.SessionFactory) AdapterStatusDao

type GenericDao

type GenericDao interface {
	Fetch(offset int, limit int, resourceList interface{}) error

	GetInstanceDao(ctx context.Context, model interface{}) GenericDao
	Preload(preload string)
	OrderBy(orderBy string)
	Joins(sql string)
	Group(sql string)
	Where(where Where)
	Count(model interface{}, total *int64) error
	Validate(resourceList interface{}) error

	GetTableName() string
	GetTableRelation(fieldName string) (TableRelation, bool)
}

func NewGenericDao

func NewGenericDao(sessionFactory db.SessionFactory) GenericDao

type ResourceConditionDao added in v0.3.1

type ResourceConditionDao interface {
	// UpdateConditions atomically replaces all condition rows for a resource.
	//
	// Prerequisites:
	//   - Write transaction (delete+insert is not atomic without one).
	//   - Caller holds a row lock on the parent resource (e.g. via GetForUpdate).
	//     Without it, concurrent callers read stale state and the loser's
	//     timestamp preservation computes against a pre-delete snapshot.
	//
	// Timestamp contract: for existing condition types, CreatedTime is always
	// preserved and LastTransitionTime is preserved when status is unchanged.
	// For new condition types, both are used as-is from the input — caller
	// must populate them. Zero timestamps are defaulted to now.
	UpdateConditions(ctx context.Context, resourceID string, conditions []api.ResourceCondition) error

	// DeleteByResource removes all condition rows for a resource.
	// Used during hard-delete to clean up before removing the resource row.
	DeleteByResource(ctx context.Context, resourceID string) error
}

func NewResourceConditionDao added in v0.3.1

func NewResourceConditionDao(sessionFactory db.SessionFactory) ResourceConditionDao

type ResourceDao added in v0.3.0

type ResourceDao interface {
	Get(ctx context.Context, kind, id string) (*api.Resource, error)
	GetForUpdate(ctx context.Context, kind, id string) (*api.Resource, error)
	GetByOwner(ctx context.Context, kind, id, ownerID string) (*api.Resource, error)
	Create(ctx context.Context, resource *api.Resource) (*api.Resource, error)
	Save(ctx context.Context, resource *api.Resource) error
	Delete(ctx context.Context, kind, id string) error
	ExistsByOwner(ctx context.Context, kind, ownerID string) (bool, error)
	ExistsSoftDeletedByOwner(ctx context.Context, kinds []string, ownerID string) (bool, error)
	FindByKind(ctx context.Context, kind string) (api.ResourceList, error)
	FindByKindAndOwner(ctx context.Context, kind, ownerID string) (api.ResourceList, error)
	FindByKindAndOwnerForUpdate(ctx context.Context, kind, ownerID string) (api.ResourceList, error)
	GetByID(ctx context.Context, id string) (*api.Resource, error)
	ReplaceReferences(ctx context.Context, sourceID string, refs []api.ResourceReference) error
	FindReferencers(ctx context.Context, targetID string) ([]api.ResourceSummary, error)
	ClearTargetReferences(ctx context.Context, targetID string) error
	FindSourceIDsByRef(ctx context.Context, refType, targetID string) ([]string, error)
}

func NewResourceDao added in v0.3.0

func NewResourceDao(sessionFactory db.SessionFactory) ResourceDao

type ResourceLabelDao added in v0.3.1

type ResourceLabelDao interface {
	ReplaceLabels(ctx context.Context, resourceID string, labels []api.ResourceLabel) error
}

func NewResourceLabelDao added in v0.3.1

func NewResourceLabelDao(sessionFactory db.SessionFactory) ResourceLabelDao

type TableRelation

type TableRelation struct {
	TableName         string
	ColumnName        string
	ForeignTableName  string
	ForeignColumnName string
}

TableRelation represents a relationship between two tables. They can be joined, ON TableName.ColumnName = ForeignTableName.ForeignColumnName

type Where

type Where struct {
	// contains filtered or unexported fields
}

func NewWhere

func NewWhere(sql string, values []any) Where

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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