Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IDSetter ¶
type IDSetter interface {
SetID(string)
}
IDSetter interface can be used by the DB to provide new IDs for objects. If Item supports this, when we Create the new item we can set a unique ID based on different DB implementations
type Item ¶
Item is a generic object which can be used to interact with the store. Users can create their own 'Item' for using the store
type ListOpt ¶
ListOpt provides different options for querying the DB Pagination can be used if supported by underlying DB
type Serializable ¶
Serializable interface for the Items to store/retrieve data to/from DB as bytes
type Sort ¶
type Sort int
Sort is an enum for using different sorting methods on the query
const ( // SortNatural use natural order SortNatural Sort = iota // SortCreatedDesc created newest to oldest SortCreatedDesc // SortCreatedAsc created oldest to newset SortCreatedAsc // SortUpdatedDesc updated newest to oldest SortUpdatedDesc // SortUpdatedAsc updated oldest to newset SortUpdatedAsc )
type Store ¶
type Store interface {
Create(Item) error
Read(Item) error
Update(Item) error
Delete(Item) error
List(Items, ListOpt) (int, error)
io.Closer
}
Store is a generic KV Store interface which provides an easier interface to access underlying database. It is mainly used to abstract the database used underneath so we can have a uniform API to use for clients
type TimeTracker ¶
type TimeTracker interface {
SetCreated(t int64)
GetCreated() int64
SetUpdated(t int64)
GetUpdated() int64
}
TimeTracker interface implements basic time tracking functionality for the objects. If Item supports this interface, additional indexes can be maintained to support queries based on this