Documentation
¶
Index ¶
- Constants
- Variables
- type DBImageRelationshipRepo
- func (repo *DBImageRelationshipRepo) AreRelated(imageId1, imageId2 string) (bool, error)
- func (repo *DBImageRelationshipRepo) CreateRelationship(imageId, parentImageId, relationshipType string) (*ImageRelationship, error)
- func (repo *DBImageRelationshipRepo) GetAncestorIds(imageId string) ([]string, error)
- func (repo *DBImageRelationshipRepo) GetChildrenByImageId(imageId string) ([]ImageRelationship, error)
- func (repo *DBImageRelationshipRepo) GetDescendantIds(imageId string) ([]string, error)
- func (repo *DBImageRelationshipRepo) GetParentsByImageId(imageId string) ([]ImageRelationship, error)
- func (repo *DBImageRelationshipRepo) GetParentsByImageIds(imageIds []string) (map[string][]ImageRelationship, error)
- func (repo *DBImageRelationshipRepo) HasRelationships(imageId string) (bool, error)
- func (repo *DBImageRelationshipRepo) IsAncestor(imageId, ancestorId string) (bool, error)
- func (repo *DBImageRelationshipRepo) WithTransaction(tx *sql.Tx) db.DBRepo
- type DBImageRepo
- func (repo *DBImageRepo) CountImages(filters *ListImagesFilters) (int, error)
- func (repo *DBImageRepo) CreateAndSaveUploadedImage(image *dm.Image, mimeType string, fileBytes []byte, storageDefinitionId string, ...) (*dm.StoredImage, error)
- func (repo *DBImageRepo) CreateImage(image *dm.Image) (*dm.Image, error)
- func (repo *DBImageRepo) CreateStoredImage(imageId string, storageDefinitionId string, fileIdentifier string, ...) (*dm.StoredImage, error)
- func (repo *DBImageRepo) DeleteImageById(id string) error
- func (repo *DBImageRepo) GetImageById(id string) (*dm.Image, error)
- func (repo *DBImageRepo) GetImagesByIds(ids []string) ([]*dm.Image, error)
- func (repo *DBImageRepo) ListImages(filtersWithoutCursor *ListImagesFilters, filtersWithCursor *ListImagesFilters, ...) (dm.ListImageResult, error)
- func (repo *DBImageRepo) WithTransaction(tx *sql.Tx) db.DBRepo
- type ImageRelationship
- type ImageRelationshipRepo
- type ImageRepo
- type ListImagesFilters
- type ListImagesOrdering
- type PaginationDirection
- type SaveFunc
Constants ¶
View Source
const ( RelationshipTypeBase = "base" RelationshipTypeOverlay = "overlay" )
Variables ¶
View Source
var ZeroUUID = uuid.UUID{}
Functions ¶
This section is empty.
Types ¶
type DBImageRelationshipRepo ¶
func NewDBImageRelationshipRepo ¶
func NewDBImageRelationshipRepo(conn *sql.DB) *DBImageRelationshipRepo
func (*DBImageRelationshipRepo) AreRelated ¶
func (repo *DBImageRelationshipRepo) AreRelated(imageId1, imageId2 string) (bool, error)
AreRelated returns true if there is any DAG path between the two images (in either direction).
func (*DBImageRelationshipRepo) CreateRelationship ¶
func (repo *DBImageRelationshipRepo) CreateRelationship(imageId, parentImageId, relationshipType string) (*ImageRelationship, error)
func (*DBImageRelationshipRepo) GetAncestorIds ¶
func (repo *DBImageRelationshipRepo) GetAncestorIds(imageId string) ([]string, error)
GetAncestorIds walks the DAG upward from imageId using a recursive CTE.
func (*DBImageRelationshipRepo) GetChildrenByImageId ¶
func (repo *DBImageRelationshipRepo) GetChildrenByImageId(imageId string) ([]ImageRelationship, error)
func (*DBImageRelationshipRepo) GetDescendantIds ¶
func (repo *DBImageRelationshipRepo) GetDescendantIds(imageId string) ([]string, error)
GetDescendantIds walks the DAG downward from imageId using a recursive CTE.
func (*DBImageRelationshipRepo) GetParentsByImageId ¶
func (repo *DBImageRelationshipRepo) GetParentsByImageId(imageId string) ([]ImageRelationship, error)
func (*DBImageRelationshipRepo) GetParentsByImageIds ¶
func (repo *DBImageRelationshipRepo) GetParentsByImageIds(imageIds []string) (map[string][]ImageRelationship, error)
func (*DBImageRelationshipRepo) HasRelationships ¶
func (repo *DBImageRelationshipRepo) HasRelationships(imageId string) (bool, error)
func (*DBImageRelationshipRepo) IsAncestor ¶
func (repo *DBImageRelationshipRepo) IsAncestor(imageId, ancestorId string) (bool, error)
IsAncestor returns true if ancestorId is a transitive parent of imageId.
func (*DBImageRelationshipRepo) WithTransaction ¶
func (repo *DBImageRelationshipRepo) WithTransaction(tx *sql.Tx) db.DBRepo
type DBImageRepo ¶
func NewDBImageRepo ¶
func NewDBImageRepo(conn *sql.DB) *DBImageRepo
func (*DBImageRepo) CountImages ¶
func (repo *DBImageRepo) CountImages(filters *ListImagesFilters) (int, error)
func (*DBImageRepo) CreateAndSaveUploadedImage ¶
func (repo *DBImageRepo) CreateAndSaveUploadedImage(image *dm.Image, mimeType string, fileBytes []byte, storageDefinitionId string, saveFn SaveFunc) (*dm.StoredImage, error)
func (*DBImageRepo) CreateImage ¶
func (*DBImageRepo) CreateStoredImage ¶
func (repo *DBImageRepo) CreateStoredImage(imageId string, storageDefinitionId string, fileIdentifier string, copiedFromId *string) (*dm.StoredImage, error)
func (*DBImageRepo) DeleteImageById ¶
func (repo *DBImageRepo) DeleteImageById(id string) error
func (*DBImageRepo) GetImageById ¶
func (repo *DBImageRepo) GetImageById(id string) (*dm.Image, error)
func (*DBImageRepo) GetImagesByIds ¶
func (repo *DBImageRepo) GetImagesByIds(ids []string) ([]*dm.Image, error)
func (*DBImageRepo) ListImages ¶
func (repo *DBImageRepo) ListImages( filtersWithoutCursor *ListImagesFilters, filtersWithCursor *ListImagesFilters, ordering *ListImagesOrdering, reverse bool, ) (dm.ListImageResult, error)
func (*DBImageRepo) WithTransaction ¶
func (repo *DBImageRepo) WithTransaction(tx *sql.Tx) db.DBRepo
type ImageRelationship ¶
type ImageRelationshipRepo ¶
type ImageRelationshipRepo interface {
CreateRelationship(imageId, parentImageId, relationshipType string) (*ImageRelationship, error)
GetParentsByImageId(imageId string) ([]ImageRelationship, error)
GetParentsByImageIds(imageIds []string) (map[string][]ImageRelationship, error)
GetChildrenByImageId(imageId string) ([]ImageRelationship, error)
HasRelationships(imageId string) (bool, error)
// GetDescendantIds returns all transitive children of the given image (not including itself).
GetDescendantIds(imageId string) ([]string, error)
// GetAncestorIds returns all transitive parents of the given image (not including itself).
GetAncestorIds(imageId string) ([]string, error)
// AreRelated returns true if there is any path between the two images in the DAG.
AreRelated(imageId1, imageId2 string) (bool, error)
// IsAncestor returns true if ancestorId is a transitive parent of imageId.
IsAncestor(imageId, ancestorId string) (bool, error)
}
type ImageRepo ¶
type ImageRepo interface {
CreateAndSaveUploadedImage(image *dm.Image, mimeType string, fileBytes []byte, storageDefinitionId string, saveFn SaveFunc) (*dm.StoredImage, error)
CreateStoredImage(imageId string, storageDefinitionId string, fileIdentifier string, copiedFromId *string) (*dm.StoredImage, error)
ListImages(filtersWithoutCursor *ListImagesFilters, filtersWithCursor *ListImagesFilters, ordering *ListImagesOrdering, reverse bool) (dm.ListImageResult, error)
CountImages(filters *ListImagesFilters) (int, error)
GetImageById(id string) (*dm.Image, error)
GetImagesByIds(ids []string) ([]*dm.Image, error)
DeleteImageById(id string) error
}
type ListImagesFilters ¶
type ListImagesFilters struct {
NameContains string
NameLt string
NameGt string
CreatedAtLt *time.Time
CreatedAtGt *time.Time
IdGt string
IdLt string
CreatedBy *string
Limit int
}
func FromPaginationFilter ¶
func FromPaginationFilter(pf *pagination.Filter) *ListImagesFilters
type ListImagesOrdering ¶
type ListImagesOrdering struct {
ID *PaginationDirection `json:"id,omitempty"`
Name *PaginationDirection `json:"name,omitempty"`
CreatedAt *PaginationDirection `json:"createdAt,omitempty"`
Checksum string
}
func FromPaginationOrder ¶
func FromPaginationOrder(po *pagination.Order) *ListImagesOrdering
type PaginationDirection ¶
type PaginationDirection string
var ( PaginationDirectionAsc PaginationDirection = "asc" PaginationDirectionDesc PaginationDirection = "desc" )
func (PaginationDirection) Reverse ¶
func (pd PaginationDirection) Reverse() PaginationDirection
Click to show internal directories.
Click to hide internal directories.