Documentation
¶
Index ¶
- type AssetDB
- func (as *AssetDB) Close() error
- func (as *AssetDB) Create(edge *types.Edge, asset oam.Asset) (*types.Entity, error)
- func (as *AssetDB) CreateEdge(edge *types.Edge) (*types.Edge, error)
- func (as *AssetDB) CreateEdgeProperty(edge *types.Edge, property oam.Property) (*types.EdgeTag, error)
- func (as *AssetDB) CreateEntityProperty(entity *types.Entity, property oam.Property) (*types.EntityTag, error)
- func (as *AssetDB) DeleteEdge(id string) error
- func (as *AssetDB) DeleteEdgeTag(id string) error
- func (as *AssetDB) DeleteEntity(id string) error
- func (as *AssetDB) DeleteEntityTag(id string) error
- func (as *AssetDB) FindByContent(asset oam.Asset, since time.Time) ([]*types.Entity, error)
- func (as *AssetDB) FindEntitiesByType(atype oam.AssetType, since time.Time) ([]*types.Entity, error)
- func (as *AssetDB) FindEntityById(id string) (*types.Entity, error)
- func (as *AssetDB) GetDBType() string
- func (as *AssetDB) GetEdgeTags(edge *types.Edge, since time.Time, names ...string) ([]*types.EdgeTag, error)
- func (as *AssetDB) GetEntityTags(entity *types.Entity, since time.Time, names ...string) ([]*types.EntityTag, error)
- func (as *AssetDB) IncomingEdges(entity *types.Entity, since time.Time, labels ...string) ([]*types.Edge, error)
- func (as *AssetDB) OutgoingEdges(entity *types.Entity, since time.Time, labels ...string) ([]*types.Edge, 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 {
Repo repository.Repository
}
AssetDB represents the asset database service.
func New ¶
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
Create creates a new entity in the database. If the edge is provided, the entity is created and linked to the source entity using the specified edge. It returns the newly created entity and an error, if any.
func (*AssetDB) CreateEdge ¶ added in v0.14.0
CreateEdge creates an edge between two entities in the database. The link is established by creating a new Edge in the database, linking the two entities. Returns the created edge as a types.Edge or an error if the link creation fails.
func (*AssetDB) CreateEdgeProperty ¶ added in v0.14.0
func (as *AssetDB) CreateEdgeProperty(edge *types.Edge, property oam.Property) (*types.EdgeTag, error)
CreateEdgeProperty creates a new edge tag in the database. It takes an oam.Property as input and persists it in the database. The edge tag is serialized to JSON and stored in the Content field of the EdgeTag struct. Returns the created edge tag as a types.EdgeTag or an error if the creation fails.
func (*AssetDB) CreateEntityProperty ¶ added in v0.14.0
func (as *AssetDB) CreateEntityProperty(entity *types.Entity, property oam.Property) (*types.EntityTag, error)
CreateEntityProperty creates a new entity tag in the database. It takes an oam.Property as input and persists it in the database. The entity tag is serialized to JSON and stored in the Content field of the EntityTag struct. Returns the created entity tag as a types.EntityTag or an error if the creation fails.
func (*AssetDB) DeleteEdge ¶ added in v0.10.0
DeleteEdge removes a relation in the database by its ID.
func (*AssetDB) DeleteEdgeTag ¶ added in v0.10.0
DeleteEdgeTag removes an edge tag in the database by its ID. It takes a string representing the edge tag ID and removes the corresponding tag from the database. Returns an error if the tag is not found.
func (*AssetDB) DeleteEntity ¶ added in v0.10.0
DeleteEntity removes an entity in the database by its ID.
func (*AssetDB) DeleteEntityTag ¶ added in v0.10.0
DeleteEntityTag removes an entity tag in the database by its ID. It takes a string representing the entity tag ID and removes the corresponding tag from the database. Returns an error if the tag is not found.
func (*AssetDB) FindByContent ¶ added in v0.1.1
FindByContent finds entities 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 entities and an error, if any.
func (*AssetDB) FindEntitiesByType ¶ added in v0.10.0
func (as *AssetDB) FindEntitiesByType(atype oam.AssetType, since time.Time) ([]*types.Entity, error)
FindEntitiesByType finds all entities 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 entities and an error, if any.
func (*AssetDB) FindEntityById ¶ added in v0.10.0
FindEntityById finds an entity in the database by the ID. It returns the matching entity and an error, if any.
func (*AssetDB) GetEdgeTags ¶ added in v0.10.0
func (as *AssetDB) GetEdgeTags(edge *types.Edge, since time.Time, names ...string) ([]*types.EdgeTag, error)
GetEdgeTags finds all tags for the edge with the specified names and last seen after the since parameter. If since.IsZero(), the parameter will be ignored. If no names are specified, all tags for the specified edge are returned.
func (*AssetDB) GetEntityTags ¶ added in v0.10.0
func (as *AssetDB) GetEntityTags(entity *types.Entity, since time.Time, names ...string) ([]*types.EntityTag, error)
GetEntityTags finds all tags for the entity with the specified names and last seen after the since parameter. If since.IsZero(), the parameter will be ignored. If no names are specified, all tags for the specified entity are returned.
func (*AssetDB) IncomingEdges ¶ added in v0.10.0
func (as *AssetDB) IncomingEdges(entity *types.Entity, since time.Time, labels ...string) ([]*types.Edge, error)
IncomingEdges finds all edges pointing to the entity for the specified labels, if any. If since.IsZero(), the parameter will be ignored. If no labels are specified, all incoming edges are returned.
func (*AssetDB) OutgoingEdges ¶ added in v0.10.0
func (as *AssetDB) OutgoingEdges(entity *types.Entity, since time.Time, labels ...string) ([]*types.Edge, error)
OutgoingEdges finds all edges from entity to another entity for the specified labels, if any. If since.IsZero(), the parameter will be ignored. If no labels are specified, all outgoing edges 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. |