Documentation
¶
Index ¶
- func InTransaction(db *sql.DB, txFunc func(*sql.Tx) error) (err error)
- type AssetRegistry
- type MariaDB
- func (m *MariaDB) Close() error
- func (m *MariaDB) CollectMetrics(ctx context.Context) (map[string]int, error)
- func (m *MariaDB) CountAssets(ctx context.Context) (int64, error)
- func (m *MariaDB) CountAssetsBySource(ctx context.Context) (map[string]int64, error)
- func (m *MariaDB) CountRelations(ctx context.Context) (int64, error)
- func (m *MariaDB) CountRelationsBySource(ctx context.Context) (map[string]int64, error)
- func (m *MariaDB) FlushAll(ctx context.Context) error
- func (m *MariaDB) GetAssetSources(ctx context.Context, ids []string) (map[string][]string, error)
- func (m *MariaDB) GetRelationSources(ctx context.Context, ids []string) (map[string][]string, error)
- func (m *MariaDB) InitializeSchema() error
- func (m *MariaDB) InsertAssets(ctx context.Context, source string, assets []knowledge.Asset) error
- func (m *MariaDB) InsertRelations(ctx context.Context, source string, relations []knowledge.Relation) error
- func (m *MariaDB) ListSources(ctx context.Context) (map[string]string, error)
- func (m *MariaDB) LoadSchema(ctx context.Context, sourceName string) (schema.SchemaGraph, error)
- func (m *MariaDB) Query(ctx context.Context, sqlTranslation knowledge.SQLTranslation) (*knowledge.GraphQueryResult, error)
- func (m *MariaDB) ReadGraph(ctx context.Context, sourceName string, encoder *knowledge.GraphEncoder) error
- func (m *MariaDB) RemoveAssets(ctx context.Context, source string, assets []knowledge.Asset) error
- func (m *MariaDB) RemoveRelations(ctx context.Context, source string, relations []knowledge.Relation) error
- func (m *MariaDB) SaveFailedQuery(ctx context.Context, cypher, sql string, err error) error
- func (m *MariaDB) SaveSchema(ctx context.Context, sourceName string, schema schema.SchemaGraph) error
- func (m *MariaDB) SaveSuccessfulQuery(ctx context.Context, cypher, sql string, duration time.Duration) error
- type MariaDBConfig
- type MariaDBCursor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssetRegistry ¶
type AssetRegistry struct {
// contains filtered or unexported fields
}
AssetRegistry store ID of assets in a cache
type MariaDB ¶
type MariaDB struct {
// contains filtered or unexported fields
}
MariaDB mariadb as graph storage backend
func NewMariaDB ¶
func NewMariaDB(cfg MariaDBConfig) *MariaDB
NewMariaDB create an instance of mariadb
func (*MariaDB) CollectMetrics ¶ added in v0.0.59
func (*MariaDB) CountAssets ¶
CountAssets count the total number of assets in db.
func (*MariaDB) CountAssetsBySource ¶ added in v0.0.52
CountAssetsBySource count the total number of assets in db by source
func (*MariaDB) CountRelations ¶
CountRelations count the total number of relations in db.
func (*MariaDB) CountRelationsBySource ¶ added in v0.0.52
CountRelationsBySource count the total number of relations in db by source.
func (*MariaDB) GetAssetSources ¶ added in v0.0.54
func (*MariaDB) GetRelationSources ¶ added in v0.0.54
func (*MariaDB) InitializeSchema ¶
InitializeSchema initialize the schema of the database
func (*MariaDB) InsertAssets ¶ added in v0.0.25
InsertAssets insert multiple assets into the graph of the given source
func (*MariaDB) InsertRelations ¶ added in v0.0.25
func (m *MariaDB) InsertRelations(ctx context.Context, source string, relations []knowledge.Relation) error
InsertRelations upsert one relation into the graph of the given source
func (*MariaDB) ListSources ¶
ListSources list sources with their authentication tokens
func (*MariaDB) LoadSchema ¶
LoadSchema load the schema graph of the source from DB
func (*MariaDB) Query ¶
func (m *MariaDB) Query(ctx context.Context, sqlTranslation knowledge.SQLTranslation) (*knowledge.GraphQueryResult, error)
Query the database with provided intermediate query representation
func (*MariaDB) ReadGraph ¶
func (m *MariaDB) ReadGraph(ctx context.Context, sourceName string, encoder *knowledge.GraphEncoder) error
ReadGraph read source subgraph
func (*MariaDB) RemoveAssets ¶ added in v0.0.25
RemoveAssets remove one asset from the graph of the given source
func (*MariaDB) RemoveRelations ¶ added in v0.0.25
func (m *MariaDB) RemoveRelations(ctx context.Context, source string, relations []knowledge.Relation) error
RemoveRelations remove relations from the graph of the given source
func (*MariaDB) SaveFailedQuery ¶ added in v0.0.6
SaveFailedQuery log an entry to mark a failed query
func (*MariaDB) SaveSchema ¶
func (m *MariaDB) SaveSchema(ctx context.Context, sourceName string, schema schema.SchemaGraph) error
SaveSchema save the schema graph in database
type MariaDBConfig ¶ added in v0.0.74
type MariaDBCursor ¶
type MariaDBCursor struct { Projections []knowledge.Projection // contains filtered or unexported fields }
MariaDBCursor is a cursor of data retrieved by MariaDB
func NewMariaDBCursor ¶ added in v0.0.13
func NewMariaDBCursor(ctx context.Context, database *sql.DB, sqlTranslation knowledge.SQLTranslation) (*MariaDBCursor, error)
NewMariaDBCursor create a new instance of MariaDBCursor
func (*MariaDBCursor) HasMore ¶
func (mc *MariaDBCursor) HasMore() bool
HasMore tells whether there are more data to retrieve from the cursor