Documentation ¶
Index ¶
- Variables
- func CreateDatabase(ctx context.Context, opt *types.SQLiteOpt) (err error)
- type DB
- func (db *DB) Close() error
- func (db *DB) CreateEntity(ctx context.Context, opt metadata.CreateEntityOpt) (int, error)
- func (db *DB) CreateFeature(ctx context.Context, opt metadata.CreateFeatureOpt) (int, error)
- func (db *DB) CreateGroup(ctx context.Context, opt metadata.CreateGroupOpt) (int, error)
- func (db *DB) CreateRevision(ctx context.Context, opt metadata.CreateRevisionOpt) (int, error)
- func (db *DB) GetEntity(ctx context.Context, id int) (*types.Entity, error)
- func (db *DB) GetEntityByName(ctx context.Context, name string) (*types.Entity, error)
- func (db *DB) GetFeature(ctx context.Context, id int) (*types.Feature, error)
- func (db *DB) GetFeatureByName(ctx context.Context, groupName string, featureName string) (*types.Feature, error)
- func (db *DB) GetGroup(ctx context.Context, id int) (*types.Group, error)
- func (db *DB) GetGroupByName(ctx context.Context, name string) (*types.Group, error)
- func (db *DB) GetRevision(ctx context.Context, id int) (*types.Revision, error)
- func (db *DB) GetRevisionBy(ctx context.Context, groupID int, revision int64) (*types.Revision, error)
- func (db *DB) ListEntity(ctx context.Context, entityIDs *[]int) (types.EntityList, error)
- func (db *DB) ListFeature(ctx context.Context, opt metadata.ListFeatureOpt) (types.FeatureList, error)
- func (db *DB) ListGroup(ctx context.Context, opt metadata.ListGroupOpt) (types.GroupList, error)
- func (db *DB) ListRevision(ctx context.Context, groupID *int) (types.RevisionList, error)
- func (db *DB) Ping(ctx context.Context) error
- func (db *DB) UpdateEntity(ctx context.Context, opt metadata.UpdateEntityOpt) error
- func (db *DB) UpdateFeature(ctx context.Context, opt metadata.UpdateFeatureOpt) error
- func (db *DB) UpdateGroup(ctx context.Context, opt metadata.UpdateGroupOpt) error
- func (db *DB) UpdateRevision(ctx context.Context, opt metadata.UpdateRevisionOpt) error
- func (db *DB) WithTransaction(ctx context.Context, fn func(context.Context, metadata.DBStore) error) error
- type Tx
- func (tx *Tx) CreateEntity(ctx context.Context, opt metadata.CreateEntityOpt) (int, error)
- func (tx *Tx) CreateFeature(ctx context.Context, opt metadata.CreateFeatureOpt) (int, error)
- func (tx *Tx) CreateGroup(ctx context.Context, opt metadata.CreateGroupOpt) (int, error)
- func (tx *Tx) CreateRevision(ctx context.Context, opt metadata.CreateRevisionOpt) (int, error)
- func (tx *Tx) GetEntity(ctx context.Context, id int) (*types.Entity, error)
- func (tx *Tx) GetEntityByName(ctx context.Context, name string) (*types.Entity, error)
- func (tx *Tx) GetFeature(ctx context.Context, id int) (*types.Feature, error)
- func (tx *Tx) GetFeatureByName(ctx context.Context, groupName string, featureName string) (*types.Feature, error)
- func (tx *Tx) GetGroup(ctx context.Context, id int) (*types.Group, error)
- func (tx *Tx) GetGroupByName(ctx context.Context, name string) (*types.Group, error)
- func (tx *Tx) GetRevision(ctx context.Context, id int) (*types.Revision, error)
- func (tx *Tx) GetRevisionBy(ctx context.Context, groupID int, revision int64) (*types.Revision, error)
- func (tx *Tx) ListEntity(ctx context.Context, entityIDs *[]int) (types.EntityList, error)
- func (tx *Tx) ListFeature(ctx context.Context, opt metadata.ListFeatureOpt) (types.FeatureList, error)
- func (tx *Tx) ListGroup(ctx context.Context, opt metadata.ListGroupOpt) (types.GroupList, error)
- func (tx *Tx) ListRevision(ctx context.Context, groupID *int) (types.RevisionList, error)
- func (tx *Tx) UpdateEntity(ctx context.Context, opt metadata.UpdateEntityOpt) error
- func (tx *Tx) UpdateFeature(ctx context.Context, opt metadata.UpdateFeatureOpt) error
- func (tx *Tx) UpdateGroup(ctx context.Context, opt metadata.UpdateGroupOpt) error
- func (tx *Tx) UpdateRevision(ctx context.Context, opt metadata.UpdateRevisionOpt) error
- func (tx *Tx) WithTransaction(ctx context.Context, fn func(context.Context, metadata.DBStore) error) error
Constants ¶
This section is empty.
Variables ¶
View Source
var META_TABLE_SCHEMAS = map[string]string{
"feature": `
CREATE TABLE feature (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name VARCHAR(32) NOT NULL,
group_id INT NOT NULL,
value_type INT NOT NULL,
description VARCHAR(128) DEFAULT '',
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
modify_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (group_id, name),
FOREIGN KEY (group_id) REFERENCES feature_group(id)
);
`,
"feature_group": `
CREATE TABLE feature_group (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name VARCHAR(32) NOT NULL,
category VARCHAR(16) NOT NULL,
entity_id INT NOT NULL,
snapshot_interval INT DEFAULT 0,
online_revision_id INT DEFAULT NULL,
description VARCHAR(64) DEFAULT '',
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
modify_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (name),
FOREIGN KEY (entity_id) REFERENCES entity(id),
FOREIGN KEY (online_revision_id) REFERENCES feature_group_revision(id)
);
`,
"entity": `
CREATE TABLE entity (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name VARCHAR(32) NOT NULL,
description VARCHAR(64) DEFAULT '',
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
modify_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (name)
);
`,
"feature_group_revision": `
CREATE TABLE feature_group_revision (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
group_id INT NOT NULL,
revision BIGINT NOT NULL,
snapshot_table VARCHAR(64) NOT NULL,
cdc_table VARCHAR(64) NOT NULL DEFAULT '',
anchored BOOLEAN NOT NULL,
description VARCHAR(64) DEFAULT '',
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
modify_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE (group_id, revision),
FOREIGN KEY (group_id) REFERENCES feature_group(id)
);
`,
}
View Source
var META_VIEW_SCHEMAS = map[string]string{}
View Source
var TRIGGER_TEMPLATE = `` /* 171-byte string literal not displayed */
Functions ¶
Types ¶
type DB ¶
func (*DB) CreateEntity ¶
func (*DB) CreateFeature ¶
func (*DB) CreateGroup ¶
func (*DB) CreateRevision ¶
func (*DB) GetEntityByName ¶
func (*DB) GetFeature ¶
func (*DB) GetFeatureByName ¶
func (*DB) GetGroupByName ¶
func (*DB) GetRevision ¶
func (*DB) GetRevisionBy ¶
func (*DB) ListEntity ¶
func (*DB) ListFeature ¶
func (db *DB) ListFeature(ctx context.Context, opt metadata.ListFeatureOpt) (types.FeatureList, error)
func (*DB) ListRevision ¶
func (*DB) UpdateEntity ¶
func (*DB) UpdateFeature ¶
func (*DB) UpdateGroup ¶
func (*DB) UpdateRevision ¶
type Tx ¶
func (*Tx) CreateEntity ¶
func (*Tx) CreateFeature ¶
func (*Tx) CreateGroup ¶
func (*Tx) CreateRevision ¶
func (*Tx) GetEntityByName ¶
func (*Tx) GetFeature ¶
func (*Tx) GetFeatureByName ¶
func (*Tx) GetGroupByName ¶
func (*Tx) GetRevision ¶
func (*Tx) GetRevisionBy ¶
func (*Tx) ListEntity ¶
func (*Tx) ListFeature ¶
func (tx *Tx) ListFeature(ctx context.Context, opt metadata.ListFeatureOpt) (types.FeatureList, error)
func (*Tx) ListRevision ¶
func (*Tx) UpdateEntity ¶
func (*Tx) UpdateFeature ¶
func (*Tx) UpdateGroup ¶
func (*Tx) UpdateRevision ¶
Click to show internal directories.
Click to hide internal directories.