Documentation ¶
Index ¶
- Variables
- type Collection
- func (col *Collection) GetID(ctx context.Context, id string, doc interface{}) error
- func (col *Collection) Insert(ctx context.Context, idoc interface{}, opts *InsertOpts) (*ID, error)
- func (col *Collection) Iter(query *Query, opts *IterOpts) (*Iter, error)
- func (col *Collection) UpdateID(ctx context.Context, id string, doc interface{}) error
- type DocStore
- func (docstore *DocStore) Col(collection string) *Collection
- func (docstore *DocStore) Collections() ([]string, error)
- func (docstore *DocStore) DownloadAttachment(ref string) (io.Reader, error)
- func (docstore *DocStore) UploadAttachment(name string, r io.Reader, data map[string]interface{}) (string, error)
- type ID
- type InsertOpts
- type Iter
- type IterOpts
- type M
- type Q
- type Query
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIDNotFound = errors.New("ID doest not exist")
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection represents a collection of documents
func (*Collection) GetID ¶
func (col *Collection) GetID(ctx context.Context, id string, doc interface{}) error
Get retrieve the document, `doc` must a map[string]interface{} or a struct pointer.
func (*Collection) Insert ¶
func (col *Collection) Insert(ctx context.Context, idoc interface{}, opts *InsertOpts) (*ID, error)
type DocStore ¶
type DocStore struct {
// contains filtered or unexported fields
}
func New ¶
func New(client *clientutil.ClientUtil) *DocStore
serverAddr should't have a trailing space
func (*DocStore) Col ¶
func (docstore *DocStore) Col(collection string) *Collection
func (*DocStore) Collections ¶
func (*DocStore) DownloadAttachment ¶
DownloadAttachment returns an `io.ReadCloser` with the file content for the given ref.
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
type InsertOpts ¶
type InsertOpts struct {
Indexed bool
}
InsertOpts defines the options for the `Insert` operation TODO(tsileo): use the same opts style as clientutil (...options)
func DefaultInsertOpts ¶
func DefaultInsertOpts() *InsertOpts
DefaultInsertOpts initializes a new `InsertOpts` with sane default
type Iter ¶
type IterOpts ¶
type IterOpts struct {
Limit int
}
func DefaultIterOtps ¶
func DefaultIterOtps() *IterOpts
Click to show internal directories.
Click to hide internal directories.