Documentation ¶
Index ¶
- Constants
- func Btoi(bytes []byte) uint64
- func CreateAssetBucketNames(ws model.WSName) []string
- func CreateMetaBucketNames() []string
- func CreatePathBucketNames(ws model.WSName) []string
- func CreateTagBucketNames(ws model.WSName) []string
- func CreateTagHistoryBucketNames(ws model.WSName) []string
- func Itob(v uint64) []byte
- type BoltData
- type Repository
- func (b *Repository) Add(bucketNames []string, data interface{}) (uint64, error)
- func (b *Repository) AddIntByString(bucketNames []string, k string, v uint64) error
- func (b *Repository) AddWithID(bucketNames []string, data BoltData) (uint64, error)
- func (b *Repository) BatchAddIntByString(bucketNames []string, keys []string, values []uint64) error
- func (b *Repository) BatchAddWithID(bucketNames []string, dataList []BoltData) (idList []uint64, err error)
- func (b *Repository) BatchGet(bucketNames []string, idList []uint64) (dataList [][]byte, err error)
- func (b *Repository) BatchGetByString(bucketNames []string, keys []string) (dataList [][]byte, err error)
- func (b *Repository) BatchUpdateByID(bucketNames []string, dataList []BoltData) (updatedDataList []BoltData, skippedDataList []BoltData, err error)
- func (b *Repository) BucketFunc(bucketNames []string, f func(bucket *bolt.Bucket) error) error
- func (b *Repository) Close() error
- func (b *Repository) CreateBucketIfNotExist(bucketNames []string) error
- func (b *Repository) Delete(bucketNames []string, id uint64) error
- func (b *Repository) ForEach(bucketNames []string, f func(value []byte) error) error
- func (b *Repository) Get(bucketNames []string, id uint64) (data []byte, exist bool, err error)
- func (b *Repository) GetIDByString(bucketNames []string, key string) (id uint64, exist bool, err error)
- func (b *Repository) List(bucketNames []string) (dataList [][]byte, err error)
- func (b *Repository) LoBucketFunc(bucketNames []string, f func(bucket *bolt.Bucket) error) error
- func (b *Repository) RecreateBucket(bucketNames []string) error
- func (b *Repository) SaveByID(bucketNames []string, data BoltData) (retID uint64, err error)
- func (b *Repository) UpdateByID(bucketNames []string, data BoltData) error
Constants ¶
const ( AssetBucketName = "Asset" PathBucketName = "Path" TagBucketName = "Tag" TagHistoryBucketName = "TagHistory" MetaBucketName = "Meta" )
Variables ¶
This section is empty.
Functions ¶
func CreateAssetBucketNames ¶
func CreateMetaBucketNames ¶
func CreateMetaBucketNames() []string
func CreatePathBucketNames ¶
func CreateTagBucketNames ¶
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(b *bolt.DB) *Repository
func (*Repository) Add ¶
func (b *Repository) Add(bucketNames []string, data interface{}) (uint64, error)
add adds data to bolt and set new ID which generated by bolt to data. So this method modifies data argument. This method always assign new ID to data, so even if already data have ID other than 0, it will be ignored and overwritten.
func (*Repository) AddIntByString ¶
func (b *Repository) AddIntByString(bucketNames []string, k string, v uint64) error
func (*Repository) AddWithID ¶
func (b *Repository) AddWithID(bucketNames []string, data BoltData) (uint64, error)
addWithID adds data to bolt and set new ID which generated by bolt to data. So this method modifies data argument. This method always assign new ID to data, so even if already data have ID other than 0, it will be ignored and overwritten.
func (*Repository) BatchAddIntByString ¶
func (b *Repository) BatchAddIntByString(bucketNames []string, keys []string, values []uint64) error
func (*Repository) BatchAddWithID ¶
func (b *Repository) BatchAddWithID(bucketNames []string, dataList []BoltData) (idList []uint64, err error)
func (*Repository) BatchGet ¶
func (b *Repository) BatchGet(bucketNames []string, idList []uint64) (dataList [][]byte, err error)
func (*Repository) BatchGetByString ¶
func (b *Repository) BatchGetByString(bucketNames []string, keys []string) (dataList [][]byte, err error)
func (*Repository) BatchUpdateByID ¶
func (b *Repository) BatchUpdateByID(bucketNames []string, dataList []BoltData) (updatedDataList []BoltData, skippedDataList []BoltData, err error)
BatchUpdateByID update data by ID. If ID does not exist in bucket, skip the data.
func (*Repository) BucketFunc ¶
func (*Repository) Close ¶
func (b *Repository) Close() error
func (*Repository) CreateBucketIfNotExist ¶
func (b *Repository) CreateBucketIfNotExist(bucketNames []string) error
func (*Repository) ForEach ¶
func (b *Repository) ForEach(bucketNames []string, f func(value []byte) error) error
func (*Repository) GetIDByString ¶
func (*Repository) List ¶
func (b *Repository) List(bucketNames []string) (dataList [][]byte, err error)
func (*Repository) LoBucketFunc ¶
func (*Repository) RecreateBucket ¶
func (b *Repository) RecreateBucket(bucketNames []string) error
func (*Repository) SaveByID ¶
func (b *Repository) SaveByID(bucketNames []string, data BoltData) (retID uint64, err error)
SaveByID add or update data. If data ID does not provided, add new data. If data ID provided, update data which have the ID. If data ID provided, but data which have the ID does not exist, return error.
func (*Repository) UpdateByID ¶
func (b *Repository) UpdateByID(bucketNames []string, data BoltData) error
UpdateByID updates data by ID. if data which have ID does not exist, return error.