sql

package
v0.0.0-...-153d94f Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Topic_base_open_insert_str = ` (id, topic_type, owner_id, name, created_time, updated_time, version, visibility, data`
View Source
const Topic_nodata_query_as_t_str_base = `SELECT t.id, t.topic_type, t.owner_id, t.name, 
			t.created_time, t.updated_time, t.version, t.visibility FROM `
View Source
const Topic_nodata_query_str_base = `SELECT id, topic_type, owner_id, name, 
			created_time, updated_time, version, visibility FROM `
View Source
const Topic_query_as_t_str_base = `SELECT t.id, t.topic_type, t.owner_id, t.name, 
			t.created_time, t.updated_time, t.version, t.visibility, t.data FROM `
View Source
const Topic_query_str_base = `SELECT id, topic_type, owner_id, name, 
			created_time, updated_time, version, visibility, data FROM `
View Source
const Topic_where_id = ` WHERE id = ?`
View Source
const Topic_where_id_in = ` WHERE id IN(?)`

Variables

View Source
var Create_relation_table_unique_name_basestmt_rocksdb_str = `` /* 774-byte string literal not displayed */
View Source
var Create_topic_table_unique_name_basestmt_rocksdb_str = `` /* 690-byte string literal not displayed */
View Source
var Topic_base_insert_str = Topic_base_open_insert_str + `)`
View Source
var Topic_insert_base_str = Topic_base_insert_str + Topic_values_str
View Source
var Topic_update_base_str = ` SET version = version + 1, updated_time = ?, data = ?`
View Source
var Topic_update_dup_base_str = ` ON DUPLICATE KEY UPDATE version = version + 1, 
			updated_time = VALUES(updated_time), data = VALUES(data)`
View Source
var Topic_values_str = ` VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`

Functions

func QueryInGroupByHavingTopicString

func QueryInGroupByHavingTopicString(
	relationTableName string,
	topicTableName string,
	names []string,
	fromIDs [][]uint64,
	relationTypes [][]uint64,
	topicIDs []uint64,
) (query string, err error)

QueryInGroupByHavingTopicString like QueryInString with FetchType_Topic based on GROUP BY AND HAVING COUNT.

func QueryInString

func QueryInString(
	relationTableName string,
	topicTableName string,
	fetchType FetchType,
	names []string,
	fromIDs [][]uint64,
	relationTypes [][]uint64,
	toIDs [][]uint64,
) (query string, err error)

QueryInString is used to query GetIn.

func QueryOutString

func QueryOutString(
	relationTableName string,
	topicTableName string,
	fetchType FetchType,
	names []string,
	fromIDs [][]uint64,
	relationTypes [][]uint64,
	toIDs [][]uint64,
) (query string, err error)

QueryOutString is used to query GetOut.

func QueryString

func QueryString(
	relationTableName string,
	topicTableName string,
	selectColumnName string,
	joinColumnName string,
	beJoinedColumnName string,
	fetchType FetchType,
	names []string,
	fromIDs [][]uint64,
	relationTypes [][]uint64,
	toIDs [][]uint64,
) (query string, err error)

QueryString is the base method for GetIn and GetOut queries, which sets the query up according to fetchType.

func RelationInsertBaseString

func RelationInsertBaseString(relationTableName string) string

func RelationInsertBaseStringOnDuplicateUpdate

func RelationInsertBaseStringOnDuplicateUpdate(relationTableName string) string

func RelationQueryByFromIDINAndRelationTypeIN

func RelationQueryByFromIDINAndRelationTypeIN(tableName string) string

func RelationQueryByFromIDINAndToIDINAndRelationTypeIN

func RelationQueryByFromIDINAndToIDINAndRelationTypeIN(tableName string) string

func RelationQueryByFromIDINOrToIDIN

func RelationQueryByFromIDINOrToIDIN(tableName string) string

func RelationQueryByFromIDOrToID

func RelationQueryByFromIDOrToID(tableName string) string

func RelationQueryByFromIDOrToIDAndRelationTypeIN

func RelationQueryByFromIDOrToIDAndRelationTypeIN(tableName string) string

func RelationQueryByFromIDToIDORSingleToIDBothDirectionsAndRelationTypeIN

func RelationQueryByFromIDToIDORSingleToIDBothDirectionsAndRelationTypeIN(tableName string) string

func RelationQueryByFromIDToIDSingleToIDBothDirections

func RelationQueryByFromIDToIDSingleToIDBothDirections(tableName string) string

func RelationQueryByToIDINAndRelationTypeIN

func RelationQueryByToIDINAndRelationTypeIN(tableName string) string

func SQLQueryTopicGetIDsAndNames

func SQLQueryTopicGetIDsAndNames(db *sql.DB, tableName string) (ids []uint64, names []string, err error)

func SQLRowsIDsToNames

func SQLRowsIDsToNames(rows *sql.Rows, ids []uint64) (names []string, allValid bool, err error)

SQLIDsToNames vulnerable to injection

func SQLRowsNamesToIDs

func SQLRowsNamesToIDs(rows *sql.Rows, names []string) (ids []uint64, allValid bool, err error)

SQLNamesToIDs vulnerable to injection

func SQLTopicGetStoredTopicFull

func SQLTopicGetStoredTopicFull(querier SQLQuerier, query string, st *StoredTopicData, args ...interface{}) (err error)

func SQLTopicGetStoredTopicsFull

func SQLTopicGetStoredTopicsFull(querier SQLQuerier, query string, args ...interface{}) (topics []StoredTopicData, err error)

func SQLTopicGetStoredTopicsFullIN

func SQLTopicGetStoredTopicsFullIN(
	querier SQLQuerier,
	tableName string,
	ids []uint64,
	fn func(tableName, idsString string) (query string),
	args ...interface{},
) (topics []StoredTopicData, err error)

func SQLTopicGetStoredTopicsFullMultiple

func SQLTopicGetStoredTopicsFullMultiple(querier SQLQuerier, queries []string, args ...interface{}) (allTopics [][]StoredTopicData, err error)

func SQLTopicGetStoredTopicsFullNameIN

func SQLTopicGetStoredTopicsFullNameIN(querier SQLQuerier, tableName string, names []string) (topics []StoredTopicData, err error)

func SQLTopicInsertStoredTopic

func SQLTopicInsertStoredTopic(executor SQLExecutor, query string, st StoredTopicDataGetter) (res sql.Result, err error)

func SQLTopicPutStoredTopic

func SQLTopicPutStoredTopic(executor SQLExecutor, query string, st StoredTopicDataGetter) (res sql.Result, err error)

SQLTopicPutStoredTopic Put refers to "ON DUPLICATE KEY UPDATE" Topic_update_dup_base_str

func SQLTopicRowToStoredTopicFull

func SQLTopicRowToStoredTopicFull(row *sql.Row, st *StoredTopicData) (err error)

func SQLTopicRowsToIDsAndNames

func SQLTopicRowsToIDsAndNames(rows *sql.Rows) (ids []uint64, names []string, err error)

func SQLTopicRowsToStoredTopicFull

func SQLTopicRowsToStoredTopicFull(rows *sql.Rows) (topics []StoredTopicData, err error)

func SQLTopicRowsToStoredTopicFullMultiple

func SQLTopicRowsToStoredTopicFullMultiple(rows *sql.Rows) (allTopics [][]StoredTopicData, err error)

func SQLTopicRowsToStoredTopicNodata

func SQLTopicRowsToStoredTopicNodata(rows *sql.Rows) (topics []StoredTopicData, err error)

func SQLTopicUpdateStoredTopic

func SQLTopicUpdateStoredTopic(executor SQLExecutor, query string, st DataElementGetter) (res sql.Result, err error)

func SQLTopicUpdateWhereIDAndVersionStoredTopic

func SQLTopicUpdateWhereIDAndVersionStoredTopic(
	executor SQLExecutor, tableName string, id, version uint64, updatedTime int64, data []byte) (res sql.Result, err error)

func SQLWhereINRelationQueryBuilderGetRelationIDsANDCombinedString

func SQLWhereINRelationQueryBuilderGetRelationIDsANDCombinedString(
	relationTableName string,
	selectTableName string,
	selectColumnName string,
	joinColumnName string,
	beJoinedColumnName string,
	names []string,
	fromIDs, relationTypes, toIDs [][]uint64,
	existingRelationTableIdx int,
) string

func SQLWhereINRelationQueryBuilderGetRelationIDsCombinedBaseString

func SQLWhereINRelationQueryBuilderGetRelationIDsCombinedBaseString(
	relationTableName string,
	selectTableName string,
	selectColumnName string,
	joinColumnName string,
	beJoinedColumnName string,
	names []string,
	fromIDs, relationTypes, toIDs [][]uint64,
	existingRelationTableIdx int,
	fnCombine func(
		relationTableAlias string,
		fromIDs, relationTypes, toIDs []uint64,
	) (str string),
) string

func SQLWhereINRelationQueryBuilderGetRelationIDsToORFromCombinedString

func SQLWhereINRelationQueryBuilderGetRelationIDsToORFromCombinedString(
	relationTableName string,
	selectTableName string,
	selectColumnName string,
	joinColumnName string,
	beJoinedColumnName string,
	names []string,
	fromIDs, relationTypes, toIDs [][]uint64,
	existingRelationTableIdx int,
) string

func SqlStringBeginIDSingleOnly

func SqlStringBeginIDSingleOnly(
	pexistingRelationTableIdx *int,
	relationTableName string,
	selectTableName string,
	selectTableColumnName string,
	joinColumnName string,
	beJoinedColumnName string,
	names []string,
	mFromIDs [][]uint64,
	mRelationTypes [][]uint64,
	mToIDs [][]uint64,
	depth int) string

SqlStringBeginIDSingleOnly defines the base query.

func TopicDeleteIDINStr

func TopicDeleteIDINStr(tableName string) string

func TopicDeleteNameINStr

func TopicDeleteNameINStr(tableName string) string

func TopicInsertBaseString

func TopicInsertBaseString(tableName string) string

func TopicInsertBaseStringOnDuplicateUpdate

func TopicInsertBaseStringOnDuplicateUpdate(tableName string) string

func TopicNodataQueryIDINStr

func TopicNodataQueryIDINStr(tableName string) string

func TopicNodataQueryNameINStr

func TopicNodataQueryNameINStr(tableName, namesString string) string

func TopicNodataQueryNameLikeLimitAndOffsetStr

func TopicNodataQueryNameLikeLimitAndOffsetStr(tableName string) string

func TopicNodataQueryNameLikeStr

func TopicNodataQueryNameLikeStr(tableName string) string

func TopicNodataQueryNameStr

func TopicNodataQueryNameStr(tableName string) string

func TopicNodataQueryOwnerIDINStr

func TopicNodataQueryOwnerIDINStr(tableName, idsString string) string

func TopicOffsetLimit

func TopicOffsetLimit() string

func TopicQueryIDINStr

func TopicQueryIDINStr(tableName, idsString string) string

func TopicQueryIDLTEStr

func TopicQueryIDLTEStr(tableName string) string

func TopicQueryIDStr

func TopicQueryIDStr(tableName string) string

func TopicQueryNameINStr

func TopicQueryNameINStr(tableName, namesString string) string

func TopicQueryNameLikeLimitAndOffsetStr

func TopicQueryNameLikeLimitAndOffsetStr(tableName string) string

func TopicQueryNameLikeStr

func TopicQueryNameLikeStr(tableName string) string

func TopicQueryNameStr

func TopicQueryNameStr(tableName string) string

func TopicQueryOwnerIDAndTopicTypeStr

func TopicQueryOwnerIDAndTopicTypeStr(tableName string) string

func TopicQueryOwnerIDINStr

func TopicQueryOwnerIDINStr(tableName, idsString string) string

func TopicQueryOwnerIDINTopicTypeINAndIDINStr

func TopicQueryOwnerIDINTopicTypeINAndIDINStr(
	tableName string,
	ownerIDsString, topicTypesString, idsString string) string

func TopicQueryOwnerIDStr

func TopicQueryOwnerIDStr(tableName string) string

func TopicQueryTopicTypeINStr

func TopicQueryTopicTypeINStr(tableName string, idsString string) string

func TopicQueryTopicTypeStr

func TopicQueryTopicTypeStr(tableName string) string

func TopicUpdateString

func TopicUpdateString(tableName string) string

func TopicUpdateWhereIDAndVersionString

func TopicUpdateWhereIDAndVersionString(tableName string) string

func UpdateDeepRelatedVersionedExecutor

func UpdateDeepRelatedVersionedExecutor(
	executor SQLExecutor,
	relationStore *RelationStore,
	updatedTime int64,
	st RelatedDataStoredTopicGetterUpdater,
	fn func(executor SQLExecutor, st RelatedDataStoredTopicGetterUpdater) (res sql.Result, err error),
) (cntUpdated uint64, err error)

UpdateVersionedExecutor is a helper method to update a versioned entry.

func UpdateVersionedDeepRelatedWhereIDAndVersionExecutor

func UpdateVersionedDeepRelatedWhereIDAndVersionExecutor(
	executor SQLExecutor,
	topicTableName string,
	relationStore *RelationStore,
	updatedTime int64,
	st RelatedDataStoredTopicGetterUpdater,
) (cntUpdated uint64, err error)

UpdateVersionedWhereIDAndVersionExecutor update a single entry where id = st.GetID() and version = st.GetVersion(), sets data = st.data, st.version += 1 on success. = "Atomic" updates via versions.

func UpdateVersionedExecutor

func UpdateVersionedExecutor(
	executor SQLExecutor,
	updatedTime int64,
	st StoredTopicDataGetterUpdater,
	fn func(executor SQLExecutor, st StoredTopicDataGetterUpdater) (res sql.Result, err error),
) (cntUpdated uint64, err error)

UpdateVersionedExecutor is a helper method to update a versioned entry.

func UpdateVersionedWhereIDAndVersionExecutor

func UpdateVersionedWhereIDAndVersionExecutor(
	executor SQLExecutor,
	tableName string,
	updatedTime int64,
	st StoredTopicDataGetterUpdater,
) (cntUpdated uint64, err error)

UpdateVersionedWhereIDAndVersionExecutor update a single entry where id = st.GetID() and version = st.GetVersion(), sets data = st.data, st.version += 1 on success. = "Atomic" updates via versions.

Types

type RelationStore

type RelationStore struct {
	Store
}

func NewRelationStoreWithDb

func NewRelationStoreWithDb(
	tableName string,
	db *sql.DB,
) (self *RelationStore)

RelationStore allocates a Store and sets the db.

func (*RelationStore) InsertDeepRelationsOnlyExecutor

func (self *RelationStore) InsertDeepRelationsOnlyExecutor(
	executor SQLExecutor,
	st *StoredTopicData,
) (err error)

InsertDeepRelationsOnlyExecutor inserts sts into the topic database and all relations deeper into the relation store.

func (*RelationStore) InsertMultiDeepRelationsOnlyExecutor

func (self *RelationStore) InsertMultiDeepRelationsOnlyExecutor(
	executor SQLExecutor,
	sts ...StoredTopicData,
) (err error)

InsertMultiDeepRelationsOnlyExecutor inserts sts into the topic database and all relations deeper into the relation store.

func (*RelationStore) InsertUpdateDeepRelationsOnlyExecutor

func (self *RelationStore) InsertUpdateDeepRelationsOnlyExecutor(
	executor SQLExecutor,
	updatedTime int64,
	st *StoredTopicData,
) (err error)

InsertUpdateDeepRelationsOnlyExecutor inserts or updates sts into the topic database and all relations deeper into the relation store.

func (*RelationStore) InsertUpdateDeepRelationsOnlyInnerExecutor

func (self *RelationStore) InsertUpdateDeepRelationsOnlyInnerExecutor(
	executor SQLExecutor,
	updatedTime int64,
	st *StoredTopicData,
) (err error)

InsertUpdateDeepRelationsOnlyInnerExecutor inserts or updates sts into the topic database and all relations deeper into the relation store.

type SQLTopicRelationStore

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

SQLTopicRelationStore topic relation store. Should share the same database "connection" because transactions for

func NewSQLTopicRelationStoreFromStores

func NewSQLTopicRelationStoreFromStores(
	topicStore *Store,
	relationStore *RelationStore,
) (self *SQLTopicRelationStore)

NewSQLTopicRelationStoreFromStores returns a newly allocated SQLTopicRelationStore from topicStore and relationStore.

func NewSQLTopicRelationStoreInit

func NewSQLTopicRelationStoreInit(
	driverName string,
	dataSourceName string,
	topicTableName string,
	relationTableName string,
) (self *SQLTopicRelationStore, err error)

NewSQLTopicRelationStoreInit returns a freshly allocated and initialized SQLTopicRelationStore.

func (*SQLTopicRelationStore) DB

func (self *SQLTopicRelationStore) DB() *sql.DB

DB returns the underlying sql.DB.

func (*SQLTopicRelationStore) GetIn

func (self *SQLTopicRelationStore) GetIn(
	topicIDs []uint64,
	fromIDsFilters [][]uint64,
	relationTypesFilters [][]uint64,
	fetchType FetchType,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetIn returns in relations or the corresponding topics. Example: gimme topics that have all in/from relations owner_id IN(fromIDsFilters[0]), topic_type IN(relationTypesFilters[0]), id IN(topicIDs) AND has owner_id IN(fromIDsFilters[1]), topic_type IN(relationTypesFilters[1]), id IN(topicIDs) for each index of toIDs and relationTypes. This method is not efficient for more topicIDs, there might be a threshold where QueryInGroupByHavingString or another solution is more efficient. -> see GetInWithMoreTopicIDs

func (*SQLTopicRelationStore) GetInAndOut

func (self *SQLTopicRelationStore) GetInAndOut(
	topicIDs []uint64,
	fromRelationTypesFilter []uint64,
	toRelationTypesFilter []uint64,
	fetchType FetchType,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetInAndOut returns in and out relations or the corresponding topics.

func (*SQLTopicRelationStore) GetInTopicsWithMoreTopicIDs

func (self *SQLTopicRelationStore) GetInTopicsWithMoreTopicIDs(
	topicIDs []uint64,
	fromIDsFilters [][]uint64,
	relationTypesFilters [][]uint64,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetInTopicsWithMoreTopicIDs results should be always like GetIn with FetchType_Topic. See GetIn for doc.

func (*SQLTopicRelationStore) GetNamesIn

func (self *SQLTopicRelationStore) GetNamesIn(
	names []string,
	fetchType FetchType,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetNamesIn gets the data where relations have name IN(names) and use the owner_id.

func (*SQLTopicRelationStore) GetNamesOut

func (self *SQLTopicRelationStore) GetNamesOut(
	names []string,
	fetchType FetchType,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetNamesOut gets the data where relations have name IN(names) and use the id.

func (*SQLTopicRelationStore) GetOut

func (self *SQLTopicRelationStore) GetOut(
	topicIDs []uint64,
	relationTypesFilters,
	toIDsFilters [][]uint64,
	fetchType FetchType,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetOut returns out relations or the corresponding topics. matches each id to the relationType (same index) Example: gimme topics that have all out/to relations id IN(toIDsFilters[0]), topic_type IN(relationTypesFilters[0]), owner_id IN(topicIDs) AND has id IN(toIDsFilters[1]), topic_type IN(relationTypesFilters[1]), owner_id IN(topicIDs) for each index of toIDs and relationTypes. https://stackoverflow.com/questions/2300322/intersect-in-mysql.

func (*SQLTopicRelationStore) InsertMultiDeep

func (self *SQLTopicRelationStore) InsertMultiDeep(
	sts ...RelatedDataStoredTopicGetter,
) (err error)

InsertMultiDeep inserts sts into the topic database and all relations deeper into the relation store.

func (*SQLTopicRelationStore) InsertMultiDeepExecutor

func (self *SQLTopicRelationStore) InsertMultiDeepExecutor(
	executor SQLExecutor,
	sts ...RelatedDataStoredTopicGetter,
) (err error)

InsertMultiDeepExecutor inserts sts into the database.

func (*SQLTopicRelationStore) InsertMultiRelatedStoredTopicDataDeepExecutor

func (self *SQLTopicRelationStore) InsertMultiRelatedStoredTopicDataDeepExecutor(
	executor SQLExecutor,
	sts []StoredTopicData,
) (err error)

InsertMultiDeepExecutor inserts sts into the database.

func (*SQLTopicRelationStore) InsertUpdateMultiDeep

func (self *SQLTopicRelationStore) InsertUpdateMultiDeep(
	updatedTime int64,
	sts ...RelatedDataStoredTopicGetterUpdater,
) (err error)

InsertUpdateMultiDeep puts all topics under des with a single transaction.

func (*SQLTopicRelationStore) InsertUpdateMultiDeepExecutor

func (self *SQLTopicRelationStore) InsertUpdateMultiDeepExecutor(
	executor SQLExecutor,
	updatedTime int64,
	sts ...RelatedDataStoredTopicGetterUpdater,
) (err error)

InsertUpdateMultiDeepExecutor puts all topics under des with a single transaction.

func (*SQLTopicRelationStore) RelationStore

func (self *SQLTopicRelationStore) RelationStore() *RelationStore

RelationStore returns the used RelationStore.

func (*SQLTopicRelationStore) TopicStore

func (self *SQLTopicRelationStore) TopicStore() *Store

TopicStore returns the used TopicStore.

func (*SQLTopicRelationStore) UpdateVersioned

func (self *SQLTopicRelationStore) UpdateVersioned(
	updatedTime int64,
	st StoredTopicDataGetterUpdater,
	fn func(st StoredTopicDataGetterUpdater) (res sql.Result, err error),
) (cntUpdated uint64, err error)

UpdateVersioned is a helper method to update a versioned entry.

func (*SQLTopicRelationStore) UpdateVersionedWhereIDAndVersion

func (self *SQLTopicRelationStore) UpdateVersionedWhereIDAndVersion(
	updatedTime int64,
	st RelatedDataStoredTopicGetterUpdater,
) (cntUpdated uint64, err error)

UpdateVersionedWhereIDAndVersion update a single entry and all the relations provided where id = st.GetID() and version = st.GetVersion(). sets data = st.data, st.version += 1 on success. = "Atomic" updates via versions.

type Store

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

Store is the SQL version of a Store.

func NewStore

func NewStore(
	tableName string,
) (self *Store)

NewStore allocates a Store.

func NewStoreMustInit

func NewStoreMustInit(
	driverName, dataSourceName string,
	tableName string,
) (self *Store)

NewStoreMustInit allocates a Store and tries to initialize it with Init. If Init returns an error the method panics.

func NewStoreWithDb

func NewStoreWithDb(
	tableName string,
	db *sql.DB,
) (self *Store)

NewStoreWithDb allocates a Store and sets the db.

func (*Store) Close

func (self *Store) Close()

func (*Store) DB

func (self *Store) DB() *sql.DB

DB returns the underlying db.

func (*Store) GetByID

func (self *Store) GetByID(
	id uint64, st *StoredTopicData) (err error)

GetByID get where id = id.

func (*Store) GetByIDIN

func (self *Store) GetByIDIN(
	ids ...uint64,
) (sts []StoredTopicData, err error)

func (*Store) GetByName

func (self *Store) GetByName(
	name string, st *StoredTopicData,
) (err error)

GetByName get where name = name.

func (*Store) GetByNameIN

func (self *Store) GetByNameIN(
	names ...string,
) (sts []StoredTopicData, err error)

func (*Store) GetByOwnerIDAndTopicType

func (self *Store) GetByOwnerIDAndTopicType(
	ownerID, topicType uint64,
) (sts []StoredTopicData, err error)

GetByOwnerIDAndTopicType get where owner_id = ownerID and topic_type = topicType.

func (*Store) GetByOwnerIDIN

func (self *Store) GetByOwnerIDIN(
	ownerIDs ...uint64,
) (sts []StoredTopicData, err error)

GetByOwnerIDIN get where owner_id IN(ownerIDs)

func (*Store) GetByTopicTypeIN

func (self *Store) GetByTopicTypeIN(
	topicTypes ...uint64,
) (sts []StoredTopicData, err error)

GetByTopicTypeIN get where topic_type IN(topicTypes)

func (*Store) GetIDsLTEDesc

func (self *Store) GetIDsLTEDesc(
	beginID uint64,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

func (*Store) Init

func (self *Store) Init(driverName, dataSourceName string) (err error)

Init tries to initialize the Store

func (*Store) Insert

func (self *Store) Insert(st StoredTopicDataGetter) (err error)

Insert inserts in the database.

func (*Store) InsertExecutor

func (self *Store) InsertExecutor(executor SQLExecutor, st StoredTopicDataGetter) (err error)

InsertExecutor inserts st to the executor

func (*Store) InsertMulti

func (self *Store) InsertMulti(sts []StoredTopicData) (err error)

InsertMulti puts all topics under des with a single transaction.

func (*Store) InsertMultiExecutor

func (self *Store) InsertMultiExecutor(executor SQLExecutor, sts []StoredTopicData) (err error)

InsertMultiExecutor puts all topics under des with a single transaction.

func (*Store) InsertUpdate

func (self *Store) InsertUpdate(
	updatedTime int64,
	st StoredTopicDataGetterUpdater,
) (err error)

InsertUpdate = insert on duplicate key update data = de.data, de.version += 1

func (*Store) InsertUpdateExecutor

func (self *Store) InsertUpdateExecutor(
	executor SQLExecutor,
	st StoredTopicDataGetter,
) (err error)

InsertUpdateExecutor = insert on duplicate key update data = de.data, de.version += 1

func (*Store) InsertUpdateMulti

func (self *Store) InsertUpdateMulti(
	updatedTime int64,
	sts []StoredTopicData,
) (err error)

InsertUpdateMulti puts all topics under des with a single transaction.

func (*Store) InsertUpdateMultiExecutor

func (self *Store) InsertUpdateMultiExecutor(
	executor SQLExecutor,
	sts []StoredTopicData,
) (err error)

InsertUpdateMultiExecutor puts all topics under des with a single transaction.

func (*Store) InsertUpdateMultiExecutorRelated

func (self *Store) InsertUpdateMultiExecutorRelated(
	executor SQLExecutor,
	sts ...RelatedDataStoredTopicGetter,
) (err error)

InsertUpdateMultiExecutor puts all topics under des with a single transaction.

func (*Store) UpdateVersionedWhereIDAndVersion

func (self *Store) UpdateVersionedWhereIDAndVersion(
	updatedTime int64,
	st StoredTopicDataGetterUpdater,
) (cntUpdated uint64, err error)

UpdateVersionedWhereIDAndVersion update a single entry where id = st.GetID() and version = st.GetVersion(), sets data = st.data, st.version += 1 on success. = "Atomic" updates via versions.

Jump to

Keyboard shortcuts

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