Documentation
¶
Overview ¶
Package assetdb provides a service to interacting with an asset database.
Index ¶
- type AssetDB
- func (as *AssetDB) Create(source *types.Asset, relation string, discovered oam.Asset) (*types.Asset, error)
- func (as *AssetDB) DeleteAsset(id string) error
- func (as *AssetDB) DeleteRelation(id string) error
- func (as *AssetDB) FindByContent(asset oam.Asset, since time.Time) ([]*types.Asset, error)
- func (as *AssetDB) FindById(id string, since time.Time) (*types.Asset, error)
- func (as *AssetDB) FindByScope(constraints []oam.Asset, since time.Time) ([]*types.Asset, error)
- func (as *AssetDB) FindByType(atype oam.AssetType, since time.Time) ([]*types.Asset, error)
- func (as *AssetDB) IncomingRelations(asset *types.Asset, since time.Time, relationTypes ...string) ([]*types.Relation, error)
- func (as *AssetDB) OutgoingRelations(asset *types.Asset, since time.Time, relationTypes ...string) ([]*types.Relation, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetDB ¶ added in v0.1.1
type AssetDB struct {
// contains filtered or unexported fields
}
AssetDB represents the asset database service.
func New ¶
func New(dbType repository.DBType, dsn string) *AssetDB
New creates a new assetDB instance. It initializes the asset database with the specified database type and DSN.
func (*AssetDB) Create ¶ added in v0.1.1
func (as *AssetDB) Create(source *types.Asset, relation string, discovered oam.Asset) (*types.Asset, error)
Create creates a new asset in the database. If source is nil, the discovered asset will be created and relation will be ignored If source and relation are provided, the asset is created and linked to the source asset using the specified relation. It returns the newly created asset and an error, if any.
func (*AssetDB) DeleteAsset ¶ added in v0.2.0
DeleteAsset removes an asset in the database by its ID.
func (*AssetDB) DeleteRelation ¶ added in v0.2.0
DeleteRelation removes a relation in the database by its ID.
func (*AssetDB) FindByContent ¶ added in v0.1.1
FindByContent finds assets in the database based on their content and last seen after the since parameter. If since.IsZero(), the parameter will be ignored. It returns a list of matching assets and an error, if any.
func (*AssetDB) FindById ¶ added in v0.1.1
FindById finds an asset in the database by its ID and last seen after the since parameter. If since.IsZero(), the parameter will be ignored. It returns the matching asset and an error, if any.
func (*AssetDB) FindByScope ¶ added in v0.2.0
FindByScope finds assets in the database by applying all the scope constraints provided and last seen after the since parameter. If since.IsZero(), the parameter will be ignored. It returns the matching assets and an error, if any.
func (*AssetDB) FindByType ¶ added in v0.2.0
FindByType finds all assets in the database of the provided asset type and last seen after the since parameter. If since.IsZero(), the parameter will be ignored. It returns the matching assets and an error, if any.
func (*AssetDB) IncomingRelations ¶ added in v0.1.1
func (as *AssetDB) IncomingRelations(asset *types.Asset, since time.Time, relationTypes ...string) ([]*types.Relation, error)
IncomingRelations finds all relations pointing to `asset“ for the specified `relationTypes`, if any. If since.IsZero(), the parameter will be ignored. If no `relationTypes` are specified, all incoming relations are returned.
func (*AssetDB) OutgoingRelations ¶ added in v0.1.1
func (as *AssetDB) OutgoingRelations(asset *types.Asset, since time.Time, relationTypes ...string) ([]*types.Relation, error)
OutgoingRelations finds all relations from `asset“ to another asset for the specified `relationTypes`, if any. If since.IsZero(), the parameter will be ignored. If no `relationTypes` are specified, all outgoing relations are returned.
Directories
¶
| Path | Synopsis |
|---|---|
|
migrations
|
|
|
postgres
Integrates with migration tools recognizing the standard "migrate up" and "migrate down" annotations, simplifying asset database schema management and rollbacks in Postgres.
|
Integrates with migration tools recognizing the standard "migrate up" and "migrate down" annotations, simplifying asset database schema management and rollbacks in Postgres. |
|
sqlite3
Integrates with migration tools recognizing the standard "migrate up" and "migrate down" annotations, simplifying asset database schema management and rollbacks in SQLite3.
|
Integrates with migration tools recognizing the standard "migrate up" and "migrate down" annotations, simplifying asset database schema management and rollbacks in SQLite3. |
|
Package repository provides a database repository implementation for managing assets and relations.
|
Package repository provides a database repository implementation for managing assets and relations. |
|
Package types provides types that represent models in databases but are not tied to a specific database implementation.
|
Package types provides types that represent models in databases but are not tied to a specific database implementation. |