sqlrepo

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Postgres     string = "postgres"
	SQLite       string = "sqlite"
	SQLiteMemory string = "sqlite_memory"
)

Variables

This section is empty.

Functions

func New

func New(dbtype, dsn string) (*sqlRepository, error)

New creates a new instance of the asset database repository.

Types

type Edge

type Edge struct {
	ID           uint64    `gorm:"primaryKey;column:edge_id"`
	CreatedAt    time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column:created_at"`
	UpdatedAt    time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column:updated_at"`
	Type         string    `gorm:"column:etype"`
	Content      datatypes.JSON
	FromEntityID uint64 `gorm:"column:from_entity_id"`
	ToEntityID   uint64 `gorm:"column:to_entity_id"`
	FromEntity   Entity
	ToEntity     Entity
}

Edge represents a relationship between two entities stored in the database.

func (*Edge) Parse

func (e *Edge) Parse() (oam.Relation, error)

Parse parses the content of the edge into the corresponding Open Asset Model (OAM) relation type. It returns the parsed relation and an error, if any.

type EdgeTag

type EdgeTag struct {
	ID        uint64    `gorm:"primaryKey;column:tag_id"`
	CreatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column:created_at"`
	UpdatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column:updated_at"`
	Type      string    `gorm:"column:ttype"`
	Content   datatypes.JSON
	EdgeID    uint64 `gorm:"column:edge_id"`
}

EdgeTag represents additional metadata added to an edge in the asset database.

func (*EdgeTag) NameJSONQuery added in v0.15.0

func (e *EdgeTag) NameJSONQuery() (*datatypes.JSONQueryExpression, error)

NameJSONQuery generates the JSON query for the field returned by the Property Name method. It returns the parsed property and an error, if any.

func (*EdgeTag) Parse

func (e *EdgeTag) Parse() (oam.Property, error)

Parse parses the content of the edge tag into the corresponding Open Asset Model (OAM) property type. It returns the parsed property and an error, if any.

func (*EdgeTag) ValueJSONQuery added in v0.15.0

func (e *EdgeTag) ValueJSONQuery() (*datatypes.JSONQueryExpression, error)

ValueJSONQuery generates the JSON query for the field returned by the Property Value method. It returns the parsed property and an error, if any.

type Entity

type Entity struct {
	ID        uint64    `gorm:"primaryKey;column:entity_id"`
	CreatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column:created_at"`
	UpdatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column:updated_at"`
	Type      string    `gorm:"column:etype"`
	Content   datatypes.JSON
}

Entity represents an entity stored in the database.

func (*Entity) JSONQuery

func (e *Entity) JSONQuery() (*datatypes.JSONQueryExpression, error)

JSONQuery generates a JSON query expression based on the entity's content. It returns the generated JSON query expression and an error, if any.

func (*Entity) Parse

func (e *Entity) Parse() (oam.Asset, error)

Parse parses the content of the entity into the corresponding Open Asset Model (OAM) asset type. It returns the parsed asset and an error, if any.

type EntityTag

type EntityTag struct {
	ID        uint64    `gorm:"primaryKey;column:tag_id"`
	CreatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column:created_at"`
	UpdatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column:updated_at"`
	Type      string    `gorm:"column:ttype"`
	Content   datatypes.JSON
	EntityID  uint64 `gorm:"column:entity_id"`
}

EntityTag represents additional metadata added to an entity in the asset database.

func (*EntityTag) NameJSONQuery added in v0.15.0

func (e *EntityTag) NameJSONQuery() (*datatypes.JSONQueryExpression, error)

NameJSONQuery generates the JSON query for the field returned by the Property Name method. It returns the parsed property and an error, if any.

func (*EntityTag) Parse

func (e *EntityTag) Parse() (oam.Property, error)

Parse parses the content of the entity tag into the corresponding Open Asset Model (OAM) property type. It returns the parsed property and an error, if any.

func (*EntityTag) ValueJSONQuery added in v0.15.0

func (e *EntityTag) ValueJSONQuery() (*datatypes.JSONQueryExpression, error)

ValueJSONQuery generates the JSON query for the field returned by the Property Value method. It returns the parsed property and an error, if any.

Jump to

Keyboard shortcuts

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