Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Asset ¶
type Asset struct {
ID uint64 `gorm:"primaryKey;autoIncrement:true"` // The unique identifier of the asset.
CreatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column=created_at"` // The creation timestamp of the asset.
LastSeen time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();column=last_seen"` // The last seen timestamp of the asset.
Type string // The type of the asset.
Content datatypes.JSON // The JSON-encoded content of the asset.
}
Asset represents an asset stored in the database.
type Relation ¶
type Relation struct {
ID uint64 `gorm:"primaryKey;autoIncrement:true"` // The unique identifier of the relation.
CreatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();"` // The creation timestamp of the relation.
LastSeen time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP();"` // The last seen timestamp of the relation.
Type string // The type of the relation.
FromAssetID uint64 // The ID of the asset from which the relation originates.
ToAssetID uint64 // The ID of the asset to which the relation points.
FromAsset Asset // The asset from which the relation originates.
ToAsset Asset // The asset to which the relation points.
}
Relation represents a relationship between two assets stored in the database.
type Repository ¶
type Repository interface {
GetDBType() string
CreateAsset(asset oam.Asset) (*types.Asset, error)
UpdateAssetLastSeen(id string) error
DeleteAsset(id string) error
DeleteRelation(id string) error
FindAssetById(id string, since time.Time) (*types.Asset, error)
FindAssetByContent(asset oam.Asset, since time.Time) ([]*types.Asset, error)
FindAssetByType(atype oam.AssetType, since time.Time) ([]*types.Asset, error)
FindAssetByScope(constraints []oam.Asset, since time.Time) ([]*types.Asset, error)
Link(source *types.Asset, relation string, destination *types.Asset) (*types.Relation, error)
IncomingRelations(asset *types.Asset, since time.Time, relationTypes ...string) ([]*types.Relation, error)
OutgoingRelations(asset *types.Asset, since time.Time, relationTypes ...string) ([]*types.Relation, error)
RawQuery(sqlstr string, results interface{}) error
AssetQuery(constraints string) ([]*types.Asset, error)
RelationQuery(constraints string) ([]*types.Relation, error)
Close() error
}
Repository defines the methods for interacting with the asset database. It provides operations for creating, retrieving, and linking assets.
Click to show internal directories.
Click to hide internal directories.