Documentation
¶
Overview ¶
Package db contains account related CRUD functionality.
Index ¶
- Constants
- type Account
- type NewAccount
- type Store
- func (s Store) AddAccount(ctx context.Context, account models.Account) (string, string, error)
- func (s Store) AddAccounts(ctx context.Context, accounts []models.Account) (bool, error)
- func (s Store) GetAccount(ctx context.Context, accountAddr string) (models.Account, error)
- func (s Store) GetAccountCountBtnKeys(ctx context.Context, startKey, endKey string) (int64, error)
- func (s Store) GetAccountsPagination(ctx context.Context, latestAccountID string, order string, pageNo, limit int64) ([]Account, int64, int64, error)
- func (s Store) GetEarliestAccountID(ctx context.Context) (string, error)
- func (s Store) GetLatestAccountID(ctx context.Context) (string, error)
Constants ¶
const (
DocType = "acct"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { NewAccount ID string `json:"_id,omitempty"` Rev string `json:"_rev,omitempty"` }
type NewAccount ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages the set of API's for account access.
func NewStore ¶
func NewStore(log *zap.SugaredLogger, couchClient *kivik.Client, dbName string) Store
NewStore constructs an account store for api access.
func (Store) AddAccount ¶
AddAccount adds an account to CouchDB. It receives the models.Account object and transform it into an Account document object and then insert it into the global CouchDB table.
func (Store) AddAccounts ¶
AddAccounts bulk-adds accounts to CouchDB. It receives the []models.Account object and transform them into Account document objects and then insert them into the global CouchDB table.
func (Store) GetAccount ¶
GetAccount retrieves a account record from CouchDB based upon the account ID given.
func (Store) GetAccountCountBtnKeys ¶
GetAccountCountBtnKeys retrieves the number of keys between two keys References:
https://stackoverflow.com/questions/11284383/couchdb-count-unique-document-field https://stackoverflow.com/questions/12944294/using-a-couchdb-view-can-i-count-groups-and-filter-by-key-range-at-the-same-tim