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) FindByContent(asset oam.Asset) ([]*types.Asset, error)
- func (as *AssetDB) FindById(id string) (*types.Asset, error)
- func (as *AssetDB) IncomingRelations(asset *types.Asset, relationTypes ...string) ([]*types.Relation, error)
- func (as *AssetDB) OutgoingRelations(asset *types.Asset, 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) FindByContent ¶ added in v0.1.1
FindByContent finds assets in the database based on their content. 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. It returns the matching asset and an error, if any.
func (*AssetDB) IncomingRelations ¶ added in v0.1.1
func (as *AssetDB) IncomingRelations(asset *types.Asset, relationTypes ...string) ([]*types.Relation, error)
IncomingRelations finds all relations pointing to `asset“ for the specified `relationTypes`, if any. 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, relationTypes ...string) ([]*types.Relation, error)
OutgoingRelations finds all relations from `asset“ to another asset for the specified `relationTypes`, if any. 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. |