Documentation ¶
Index ¶
- Constants
- Variables
- func QueryInGroupByHavingTopicString(relationTableName string, topicTableName string, names []string, ...) (query string, err error)
- func QueryInString(relationTableName string, topicTableName string, fetchType FetchType, ...) (query string, err error)
- func QueryOutString(relationTableName string, topicTableName string, fetchType FetchType, ...) (query string, err error)
- func QueryString(relationTableName string, topicTableName string, selectColumnName string, ...) (query string, err error)
- func RelationInsertBaseString(relationTableName string) string
- func RelationInsertBaseStringOnDuplicateUpdate(relationTableName string) string
- func RelationQueryByFromIDINAndRelationTypeIN(tableName string) string
- func RelationQueryByFromIDINAndToIDINAndRelationTypeIN(tableName string) string
- func RelationQueryByFromIDINOrToIDIN(tableName string) string
- func RelationQueryByFromIDOrToID(tableName string) string
- func RelationQueryByFromIDOrToIDAndRelationTypeIN(tableName string) string
- func RelationQueryByFromIDToIDORSingleToIDBothDirectionsAndRelationTypeIN(tableName string) string
- func RelationQueryByFromIDToIDSingleToIDBothDirections(tableName string) string
- func RelationQueryByToIDINAndRelationTypeIN(tableName string) string
- func SQLQueryTopicGetIDsAndNames(db *sql.DB, tableName string) (ids []uint64, names []string, err error)
- func SQLRowsIDsToNames(rows *sql.Rows, ids []uint64) (names []string, allValid bool, err error)
- func SQLRowsNamesToIDs(rows *sql.Rows, names []string) (ids []uint64, allValid bool, err error)
- func SQLTopicGetStoredTopicFull(querier SQLQuerier, query string, st *StoredTopicData, args ...interface{}) (err error)
- func SQLTopicGetStoredTopicsFull(querier SQLQuerier, query string, args ...interface{}) (topics []StoredTopicData, err error)
- func SQLTopicGetStoredTopicsFullIN(querier SQLQuerier, tableName string, ids []uint64, ...) (topics []StoredTopicData, err error)
- func SQLTopicGetStoredTopicsFullMultiple(querier SQLQuerier, queries []string, args ...interface{}) (allTopics [][]StoredTopicData, err error)
- func SQLTopicGetStoredTopicsFullNameIN(querier SQLQuerier, tableName string, names []string) (topics []StoredTopicData, err error)
- func SQLTopicInsertStoredTopic(executor SQLExecutor, query string, st StoredTopicDataGetter) (res sql.Result, err error)
- func SQLTopicPutStoredTopic(executor SQLExecutor, query string, st StoredTopicDataGetter) (res sql.Result, err error)
- func SQLTopicRowToStoredTopicFull(row *sql.Row, st *StoredTopicData) (err error)
- func SQLTopicRowsToIDsAndNames(rows *sql.Rows) (ids []uint64, names []string, err error)
- func SQLTopicRowsToStoredTopicFull(rows *sql.Rows) (topics []StoredTopicData, err error)
- func SQLTopicRowsToStoredTopicFullMultiple(rows *sql.Rows) (allTopics [][]StoredTopicData, err error)
- func SQLTopicRowsToStoredTopicNodata(rows *sql.Rows) (topics []StoredTopicData, err error)
- func SQLTopicUpdateStoredTopic(executor SQLExecutor, query string, st DataElementGetter) (res sql.Result, err error)
- func SQLTopicUpdateWhereIDAndVersionStoredTopic(executor SQLExecutor, tableName string, id, version uint64, updatedTime int64, ...) (res sql.Result, err error)
- func SQLWhereINRelationQueryBuilderGetRelationIDsANDCombinedString(relationTableName string, selectTableName string, selectColumnName string, ...) string
- func SQLWhereINRelationQueryBuilderGetRelationIDsCombinedBaseString(relationTableName string, selectTableName string, selectColumnName string, ...) string
- func SQLWhereINRelationQueryBuilderGetRelationIDsToORFromCombinedString(relationTableName string, selectTableName string, selectColumnName string, ...) string
- func SqlStringBeginIDSingleOnly(pexistingRelationTableIdx *int, relationTableName string, ...) string
- func TopicDeleteIDINStr(tableName string) string
- func TopicDeleteNameINStr(tableName string) string
- func TopicInsertBaseString(tableName string) string
- func TopicInsertBaseStringOnDuplicateUpdate(tableName string) string
- func TopicNodataQueryIDINStr(tableName string) string
- func TopicNodataQueryNameINStr(tableName, namesString string) string
- func TopicNodataQueryNameLikeLimitAndOffsetStr(tableName string) string
- func TopicNodataQueryNameLikeStr(tableName string) string
- func TopicNodataQueryNameStr(tableName string) string
- func TopicNodataQueryOwnerIDINStr(tableName, idsString string) string
- func TopicOffsetLimit() string
- func TopicQueryIDINStr(tableName, idsString string) string
- func TopicQueryIDLTEStr(tableName string) string
- func TopicQueryIDStr(tableName string) string
- func TopicQueryNameINStr(tableName, namesString string) string
- func TopicQueryNameLikeLimitAndOffsetStr(tableName string) string
- func TopicQueryNameLikeStr(tableName string) string
- func TopicQueryNameStr(tableName string) string
- func TopicQueryOwnerIDAndTopicTypeStr(tableName string) string
- func TopicQueryOwnerIDINStr(tableName, idsString string) string
- func TopicQueryOwnerIDINTopicTypeINAndIDINStr(tableName string, ownerIDsString, topicTypesString, idsString string) string
- func TopicQueryOwnerIDStr(tableName string) string
- func TopicQueryTopicTypeINStr(tableName string, idsString string) string
- func TopicQueryTopicTypeStr(tableName string) string
- func TopicUpdateString(tableName string) string
- func TopicUpdateWhereIDAndVersionString(tableName string) string
- func UpdateDeepRelatedVersionedExecutor(executor SQLExecutor, relationStore *RelationStore, updatedTime int64, ...) (cntUpdated uint64, err error)
- func UpdateVersionedDeepRelatedWhereIDAndVersionExecutor(executor SQLExecutor, topicTableName string, relationStore *RelationStore, ...) (cntUpdated uint64, err error)
- func UpdateVersionedExecutor(executor SQLExecutor, updatedTime int64, st StoredTopicDataGetterUpdater, ...) (cntUpdated uint64, err error)
- func UpdateVersionedWhereIDAndVersionExecutor(executor SQLExecutor, tableName string, updatedTime int64, ...) (cntUpdated uint64, err error)
- type RelationStore
- func (self *RelationStore) InsertDeepRelationsOnlyExecutor(executor SQLExecutor, st *StoredTopicData) (err error)
- func (self *RelationStore) InsertMultiDeepRelationsOnlyExecutor(executor SQLExecutor, sts ...StoredTopicData) (err error)
- func (self *RelationStore) InsertUpdateDeepRelationsOnlyExecutor(executor SQLExecutor, updatedTime int64, st *StoredTopicData) (err error)
- func (self *RelationStore) InsertUpdateDeepRelationsOnlyInnerExecutor(executor SQLExecutor, updatedTime int64, st *StoredTopicData) (err error)
- type SQLTopicRelationStore
- func (self *SQLTopicRelationStore) DB() *sql.DB
- func (self *SQLTopicRelationStore) GetIn(topicIDs []uint64, fromIDsFilters [][]uint64, relationTypesFilters [][]uint64, ...) (sts []StoredTopicData, err error)
- func (self *SQLTopicRelationStore) GetInAndOut(topicIDs []uint64, fromRelationTypesFilter []uint64, ...) (sts []StoredTopicData, err error)
- func (self *SQLTopicRelationStore) GetInTopicsWithMoreTopicIDs(topicIDs []uint64, fromIDsFilters [][]uint64, relationTypesFilters [][]uint64, ...) (sts []StoredTopicData, err error)
- func (self *SQLTopicRelationStore) GetNamesIn(names []string, fetchType FetchType, offset, limit uint64) (sts []StoredTopicData, err error)
- func (self *SQLTopicRelationStore) GetNamesOut(names []string, fetchType FetchType, offset, limit uint64) (sts []StoredTopicData, err error)
- func (self *SQLTopicRelationStore) GetOut(topicIDs []uint64, relationTypesFilters, toIDsFilters [][]uint64, ...) (sts []StoredTopicData, err error)
- func (self *SQLTopicRelationStore) InsertMultiDeep(sts ...RelatedDataStoredTopicGetter) (err error)
- func (self *SQLTopicRelationStore) InsertMultiDeepExecutor(executor SQLExecutor, sts ...RelatedDataStoredTopicGetter) (err error)
- func (self *SQLTopicRelationStore) InsertMultiRelatedStoredTopicDataDeepExecutor(executor SQLExecutor, sts []StoredTopicData) (err error)
- func (self *SQLTopicRelationStore) InsertUpdateMultiDeep(updatedTime int64, sts ...RelatedDataStoredTopicGetterUpdater) (err error)
- func (self *SQLTopicRelationStore) InsertUpdateMultiDeepExecutor(executor SQLExecutor, updatedTime int64, ...) (err error)
- func (self *SQLTopicRelationStore) RelationStore() *RelationStore
- func (self *SQLTopicRelationStore) TopicStore() *Store
- func (self *SQLTopicRelationStore) UpdateVersioned(updatedTime int64, st StoredTopicDataGetterUpdater, ...) (cntUpdated uint64, err error)
- func (self *SQLTopicRelationStore) UpdateVersionedWhereIDAndVersion(updatedTime int64, st RelatedDataStoredTopicGetterUpdater) (cntUpdated uint64, err error)
- type Store
- func (self *Store) Close()
- func (self *Store) DB() *sql.DB
- func (self *Store) GetByID(id uint64, st *StoredTopicData) (err error)
- func (self *Store) GetByIDIN(ids ...uint64) (sts []StoredTopicData, err error)
- func (self *Store) GetByName(name string, st *StoredTopicData) (err error)
- func (self *Store) GetByNameIN(names ...string) (sts []StoredTopicData, err error)
- func (self *Store) GetByOwnerIDAndTopicType(ownerID, topicType uint64) (sts []StoredTopicData, err error)
- func (self *Store) GetByOwnerIDIN(ownerIDs ...uint64) (sts []StoredTopicData, err error)
- func (self *Store) GetByTopicTypeIN(topicTypes ...uint64) (sts []StoredTopicData, err error)
- func (self *Store) GetIDsLTEDesc(beginID uint64, offset, limit uint64) (sts []StoredTopicData, err error)
- func (self *Store) Init(driverName, dataSourceName string) (err error)
- func (self *Store) Insert(st StoredTopicDataGetter) (err error)
- func (self *Store) InsertExecutor(executor SQLExecutor, st StoredTopicDataGetter) (err error)
- func (self *Store) InsertMulti(sts []StoredTopicData) (err error)
- func (self *Store) InsertMultiExecutor(executor SQLExecutor, sts []StoredTopicData) (err error)
- func (self *Store) InsertUpdate(updatedTime int64, st StoredTopicDataGetterUpdater) (err error)
- func (self *Store) InsertUpdateExecutor(executor SQLExecutor, st StoredTopicDataGetter) (err error)
- func (self *Store) InsertUpdateMulti(updatedTime int64, sts []StoredTopicData) (err error)
- func (self *Store) InsertUpdateMultiExecutor(executor SQLExecutor, sts []StoredTopicData) (err error)
- func (self *Store) InsertUpdateMultiExecutorRelated(executor SQLExecutor, sts ...RelatedDataStoredTopicGetter) (err error)
- func (self *Store) UpdateVersionedWhereIDAndVersion(updatedTime int64, st StoredTopicDataGetterUpdater) (cntUpdated uint64, err error)
Constants ¶
const Topic_base_open_insert_str = ` (id, topic_type, owner_id, name, created_time, updated_time, version, visibility, data`
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 `
const Topic_nodata_query_str_base = `SELECT id, topic_type, owner_id, name,
created_time, updated_time, version, visibility FROM `
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 `
const Topic_query_str_base = `SELECT id, topic_type, owner_id, name,
created_time, updated_time, version, visibility, data FROM `
const Topic_where_id = ` WHERE id = ?`
const Topic_where_id_in = ` WHERE id IN(?)`
Variables ¶
var Create_relation_table_unique_name_basestmt_rocksdb_str = `` /* 774-byte string literal not displayed */
var Create_topic_table_unique_name_basestmt_rocksdb_str = `` /* 690-byte string literal not displayed */
var Topic_base_insert_str = Topic_base_open_insert_str + `)`
var Topic_insert_base_str = Topic_base_insert_str + Topic_values_str
var Topic_update_base_str = ` SET version = version + 1, updated_time = ?, data = ?`
var Topic_update_dup_base_str = ` ON DUPLICATE KEY UPDATE version = version + 1,
updated_time = VALUES(updated_time), data = VALUES(data)`
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 SQLRowsIDsToNames ¶
SQLIDsToNames vulnerable to injection
func SQLRowsNamesToIDs ¶
SQLNamesToIDs vulnerable to injection
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 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 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 TopicDeleteNameINStr ¶
func TopicInsertBaseString ¶
func TopicNodataQueryIDINStr ¶
func TopicNodataQueryNameStr ¶
func TopicOffsetLimit ¶
func TopicOffsetLimit() string
func TopicQueryIDINStr ¶
func TopicQueryIDLTEStr ¶
func TopicQueryIDStr ¶
func TopicQueryNameINStr ¶
func TopicQueryNameLikeStr ¶
func TopicQueryNameStr ¶
func TopicQueryOwnerIDINStr ¶
func TopicQueryOwnerIDStr ¶
func TopicQueryTopicTypeStr ¶
func TopicUpdateString ¶
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 NewStoreMustInit ¶
NewStoreMustInit allocates a Store and tries to initialize it with Init. If Init returns an error the method panics.
func NewStoreWithDb ¶
NewStoreWithDb allocates a Store and sets the db.
func (*Store) GetByNameIN ¶
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 ¶
GetByOwnerIDIN get where owner_id IN(ownerIDs)
func (*Store) GetByTopicTypeIN ¶
GetByTopicTypeIN get where topic_type IN(topicTypes)
func (*Store) GetIDsLTEDesc ¶
func (*Store) InsertExecutor ¶
InsertExecutor inserts st to the executor
func (*Store) InsertMulti ¶
InsertMulti puts all topics under des with a single transaction.
func (*Store) InsertMultiExecutor ¶
InsertMultiExecutor puts all topics under des with a single transaction.
func (*Store) InsertUpdate ¶
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 ¶
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.