database

package
v0.0.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetRegistry

type AssetRegistry struct {
	// contains filtered or unexported fields
}

AssetRegistry store ID of assets in a cache

func (*AssetRegistry) Get

func (ar *AssetRegistry) Get(a knowledge.AssetKey) (int64, bool)

Get id of an asset

func (*AssetRegistry) Set

func (ar *AssetRegistry) Set(a knowledge.AssetKey, idx int64)

Set id of an asset

type MariaDB

type MariaDB struct {
	// contains filtered or unexported fields
}

MariaDB mariadb as graph storage backend

func NewMariaDB

func NewMariaDB(username string, password string, host string, databaseName string, allowCleartextPassword bool) *MariaDB

NewMariaDB create an instance of mariadb

func (*MariaDB) Close

func (m *MariaDB) Close() error

Close close the connection to maria

func (*MariaDB) CountAssets

func (m *MariaDB) CountAssets() (int64, error)

CountAssets count the total number of assets in db.

func (*MariaDB) CountRelations

func (m *MariaDB) CountRelations() (int64, error)

CountRelations count the total number of relations in db.

func (*MariaDB) FlushAll

func (m *MariaDB) FlushAll() error

FlushAll flush the database

func (*MariaDB) InitializeSchema

func (m *MariaDB) InitializeSchema() error

InitializeSchema initialize the schema of the database

func (*MariaDB) InsertAssets added in v0.0.25

func (m *MariaDB) InsertAssets(source string, assets []knowledge.Asset) error

InsertAssets insert multiple assets into the graph of the given source

func (*MariaDB) InsertRelations added in v0.0.25

func (m *MariaDB) InsertRelations(source string, relations []knowledge.Relation) error

InsertRelations upsert one relation into the graph of the given source

func (*MariaDB) ListSources

func (m *MariaDB) ListSources(ctx context.Context) (map[string]string, error)

ListSources list sources with their authentication tokens

func (*MariaDB) LoadSchema

func (m *MariaDB) LoadSchema(ctx context.Context, sourceName string) (schema.SchemaGraph, error)

LoadSchema load the schema graph of the source from DB

func (*MariaDB) Query

Query the database with provided intermediate query representation

func (*MariaDB) ReadGraph

func (m *MariaDB) ReadGraph(sourceName string, graph *knowledge.Graph) error

ReadGraph read source subgraph

func (*MariaDB) RemoveAssets added in v0.0.25

func (m *MariaDB) RemoveAssets(source string, assets []knowledge.Asset) error

RemoveAssets remove one asset from the graph of the given source

func (*MariaDB) RemoveRelations added in v0.0.25

func (m *MariaDB) RemoveRelations(source string, relations []knowledge.Relation) error

RemoveRelations remove relations from the graph of the given source

func (*MariaDB) SaveFailedQuery added in v0.0.6

func (m *MariaDB) SaveFailedQuery(ctx context.Context, cypher, sql string, err error) error

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

func (*MariaDB) SaveSuccessfulQuery added in v0.0.6

func (m *MariaDB) SaveSuccessfulQuery(ctx context.Context, cypher, sql string, duration time.Duration) error

SaveSuccessfulQuery log an entry to mark a successful query

type MariaDBCursor

type MariaDBCursor struct {
	*sql.Rows

	Projections []knowledge.Projection
}

MariaDBCursor is a cursor of data retrieved by MariaDB

func NewMariaDBCursor added in v0.0.13

func NewMariaDBCursor(rows *sql.Rows, projections []knowledge.Projection) *MariaDBCursor

NewMariaDBCursor create a new instance of MariaDBCursor

func (*MariaDBCursor) Close

func (mc *MariaDBCursor) Close() error

Close the cursor

func (*MariaDBCursor) HasMore

func (mc *MariaDBCursor) HasMore() bool

HasMore tells whether there are more data to retrieve from the cursor

func (*MariaDBCursor) Read

func (mc *MariaDBCursor) Read(ctx context.Context, doc interface{}) error

Read read one more item from the cursor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL