models

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	BaseModel
	ArtifactKey
	DatasetUUID        string         `gorm:"type:uuid;index:artifacts_dataset_uuid_idx"`
	Dataset            Dataset        `gorm:"association_autocreate:false"`
	ArtifactData       []ArtifactData `` /* 174-byte string literal not displayed */
	Partitions         []Partition    `gorm:"association_foreignkey:ArtifactID;foreignkey:ArtifactID"`
	Tags               []Tag          `gorm:"association_foreignkey:ArtifactID,DatasetUUID;foreignkey:ArtifactID,DatasetUUID"`
	SerializedMetadata []byte
}

type ArtifactData

type ArtifactData struct {
	BaseModel
	ArtifactKey
	Name     string `gorm:"primary_key"`
	Location string
}

type ArtifactKey

type ArtifactKey struct {
	DatasetProject string `gorm:"primary_key"`
	DatasetName    string `gorm:"primary_key"`
	DatasetDomain  string `gorm:"primary_key"`
	DatasetVersion string `gorm:"primary_key"`
	ArtifactID     string `gorm:"primary_key"`
}

type BaseModel

type BaseModel struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

type DBQueryExpr added in v0.1.2

type DBQueryExpr struct {
	Query string
	Args  interface{}
}

Encapsulates the query and necessary arguments to issue a DB query.

type Dataset

type Dataset struct {
	BaseModel
	DatasetKey
	SerializedMetadata []byte
	PartitionKeys      []PartitionKey `gorm:"association_foreignkey:UUID;foreignkey:DatasetUUID"`
}

type DatasetKey

type DatasetKey struct {
	Project string `gorm:"primary_key;"`                          // part of pkey, no index needed as it is first column in the pkey
	Name    string `gorm:"primary_key;index:dataset_name_idx"`    // part of pkey and has separate index for filtering
	Domain  string `gorm:"primary_key;index:dataset_domain_idx"`  // part of pkey and has separate index for filtering
	Version string `gorm:"primary_key;index:dataset_version_idx"` // part of pkey and has separate index for filtering
	UUID    string `gorm:"type:uuid;unique;default:uuid_generate_v4()"`
}

type ListModelsInput added in v0.1.2

type ListModelsInput struct {
	// The filters for the list
	ModelFilters []ModelFilter
	// The number of models to list
	Limit uint32
	// The token to offset results by
	Offset uint32
	// Parameter to sort by
	SortParameter SortParameter
}

Inputs to specify to list models

type ModelFilter added in v0.1.2

type ModelFilter struct {
	ValueFilters  []ModelValueFilter
	JoinCondition ModelJoinCondition
	Entity        common.Entity
}

A single filter for a model encompasses value filters and optionally a join condition if the filter is not on the source model

type ModelJoinCondition added in v0.1.2

type ModelJoinCondition interface {
	GetJoinOnDBQueryExpression(sourceTableName string, joiningTableName string, joiningTableAlias string) (string, error)
}

Generates the join expressions for filters that require other entities

type ModelValueFilter added in v0.1.2

type ModelValueFilter interface {
	GetDBQueryExpression(tableName string) (DBQueryExpr, error)
}

Generates db filter expressions for model values

type Partition added in v0.1.2

type Partition struct {
	BaseModel
	DatasetUUID string `gorm:"primary_key;type:uuid"`
	Key         string `gorm:"primary_key"`
	Value       string `gorm:"primary_key"`
	ArtifactID  string `gorm:"primary_key;index"` // index for JOINs with the Tag/Labels table when querying artifacts
}

Main Use cases: 1. Filter artifacts by partition key/val in a dataset from UI [x] 2. Get the artifact that has the partitions (x,y,z + tag_name) = latest [x]

type PartitionKey added in v0.1.2

type PartitionKey struct {
	BaseModel
	DatasetUUID string `gorm:"type:uuid;primary_key"`
	Name        string `gorm:"primary_key"`
}

type SortParameter added in v0.1.2

type SortParameter interface {
	GetDBOrderExpression(tableName string) string
}

type Tag

type Tag struct {
	BaseModel
	TagKey
	ArtifactID  string
	DatasetUUID string   `gorm:"type:uuid;index:tags_dataset_uuid_idx"`
	Artifact    Artifact `` /* 174-byte string literal not displayed */
}

type TagKey

type TagKey struct {
	DatasetProject string `gorm:"primary_key"`
	DatasetName    string `gorm:"primary_key"`
	DatasetDomain  string `gorm:"primary_key"`
	DatasetVersion string `gorm:"primary_key"`
	TagName        string `gorm:"primary_key"`
}

Jump to

Keyboard shortcuts

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