Documentation ¶
Index ¶
- Constants
- Variables
- type AdminUser
- type AdminUsers
- type Admins
- type Attachment
- type ChangesOptions
- type DatabaseStats
- type DesignDocFn
- type DocPrefix
- type Document
- func (doc *Document) Exists(path string) bool
- func (doc *Document) Field(path string) interface{}
- func (doc *Document) Functions() []*Function
- func (doc Document) IsDesignDoc() bool
- func (doc Document) IsLocalDoc() bool
- func (doc Document) Language() string
- func (doc Document) NextSequenceRevision() int
- func (doc Document) Revision() (string, bool)
- func (doc Document) Revisions() Revisions
- func (doc Document) ValidUpdateRevision(newDoc *Document) bool
- func (doc *Document) View(name string) (view *View, ok bool)
- type DocumentField
- type ExecutionStats
- type FieldSelector
- type FindQuery
- type FnType
- type Function
- type IndexStats
- type IteratorOptions
- type Members
- type Proxy
- type ProxyType
- type Revisions
- type SearchIndexOption
- type Security
- type SelectorGroup
- type SelectorGroupOp
- type SelectorOp
- type SelectorQuery
- type SelectorValue
- func (sv SelectorValue) ArrayLen() int
- func (sv *SelectorValue) GeaterThen(other *SelectorValue) bool
- func (sv *SelectorValue) IsNumber() bool
- func (sv *SelectorValue) LessThen(other *SelectorValue) bool
- func (sv *SelectorValue) Match(other *SelectorValue) (bool, error)
- func (sv *SelectorValue) Set(v interface{})
- func (sv *SelectorValue) Type() string
- func (sv SelectorValue) Values() []SelectorValue
- type SelectorValueType
- type Session
- type Sort
- type SortList
- type SortQuery
- type Task
- type TaskAction
- type User
- type View
- type VirtualHostConfiguration
Constants ¶
View Source
const ( SortOrderAsc = false SortOrderDesc = true )
View Source
const ( SelectorValueTypeNil = iota SelectorValueTypeBool SelectorValueTypeArray SelectorValueTypeObject SelectorValueTypeInt SelectorValueTypeFloat SelectorValueTypeString SelectorValueTypeOther )
View Source
const RoleServerAdmin = "_admin"
Variables ¶
View Source
var DocsBucket = []byte("docs")
Functions ¶
This section is empty.
Types ¶
type AdminUsers ¶
type AdminUsers []AdminUser
func ParseAdmins ¶
func ParseAdmins(admins string) (AdminUsers, error)
func (AdminUsers) Authenticate ¶
func (a AdminUsers) Authenticate(username, password string) *AdminUser
type Attachment ¶
type ChangesOptions ¶
func (*ChangesOptions) SinceNow ¶
func (o *ChangesOptions) SinceNow() bool
type DatabaseStats ¶
type DesignDocFn ¶
func NewSearchFn ¶
func NewSearchFn(designDocID, fnName string) DesignDocFn
func NewViewFn ¶
func NewViewFn(designDocID, fnName string) DesignDocFn
func ParseDesignDocFn ¶
func ParseDesignDocFn(str string) (*DesignDocFn, error)
func (DesignDocFn) Bucket ¶
func (ddfn DesignDocFn) Bucket() []byte
func (DesignDocFn) String ¶
func (ddfn DesignDocFn) String() string
type Document ¶
type Document struct { // Meta ID string `json:"_id,omitempty"` Rev string `json:"_rev,omitempty"` Deleted bool `json:"_deleted,omitempty"` LocalSeq uint64 `json:"_local_seq,omitempty"` // Data Attachments map[string]*Attachment `json:"_attachments,omitempty"` Data map[string]interface{} `json:"data,omitempty"` // View Key interface{} `json:"key,omitempty"` Value interface{} `json:"value,omitempty"` // Search Fields map[string]interface{} `json:"fields,omitempty"` Options map[string]SearchIndexOption `json:"options,omitempty"` }
func (Document) IsDesignDoc ¶
func (Document) IsLocalDoc ¶
func (Document) NextSequenceRevision ¶
func (Document) ValidUpdateRevision ¶
type DocumentField ¶
type DocumentField interface { // Field get a field value (nesting supported with . operator) Field(path string) interface{} Exists(path string) bool }
DocumentField provide a field from a document handles nested document traversal
type ExecutionStats ¶
type ExecutionStats struct { // TotalKeysExamined // Number of index keys examined. Currently always 0. TotalKeysExamined int `json:"total_keys_examined"` // TotalDocsExamined // Number of documents fetched from the database / index, // equivalent to using include_docs=true in a view. These // may then be filtered in-memory to further narrow down // the result set based on the selector. TotalDocsExamined int `json:"total_docs_examined"` // TotalQuorumDocsExamined // Number of documents fetched from the database using an // out-of-band document fetch. This is only non-zero when // read quorum > 1 is specified in the query parameters. TotalQuorumDocsExamined int `json:"total_quorum_docs_examined"` // ResultsReturned // Number of results returned from the query. Ideally this // should not be significantly lower than the total // documents / keys examined. ResultsReturned int `json:"results_returned"` // ExecutionTime // Total execution time in milliseconds as measured by the // database. ExecutionTime float64 `json:"execution_time_ms"` }
type FieldSelector ¶
type FieldSelector struct { Field string Value interface{} Operation SelectorOp }
func (FieldSelector) Match ¶
func (fs FieldSelector) Match(df DocumentField) (bool, error)
func (FieldSelector) String ¶
func (fs FieldSelector) String() string
func (*FieldSelector) UnmarshalJSON ¶
func (fs *FieldSelector) UnmarshalJSON(blob []byte) error
type FindQuery ¶
type FindQuery struct { // Selector JSON object describing criteria used to select documents. // More information provided in the section on selector syntax. Selector SelectorGroup `json:"selector"` // Sort JSON array following sort syntax. Optional Sort SortList `json:"sort"` // Fields JSON array specifying which fields of each object should be returned. // If it is omitted, the entire object is returned. More information // provided in the section on filtering fields. Optional Fields []string `json:"fields"` // Limit Maximum number of results returned. Default is 25. Optional Limit int `json:"limit"` // Skip the first ‘n’ results, where ‘n’ is the value specified. Optional Skip int `json:"skip"` // Bookmark a string that enables you to specify which page of // results you require. Used for paging through result sets. // Every query returns an opaque string under the bookmark key // that can then be passed back in a query to get the next page // of results. If any part of the selector query changes between // requests, the results are undefined. Bookmark string `json:"bookmark"` // Include execution statistics in the query response. ExecutionStats bool `json:"execution_stats"` }
func (FindQuery) SortDocuments ¶
type Function ¶
type Function struct { Name string Type FnType MapFn string ReduceFn string SearchFn string Analyzer string // contains filtered or unexported fields }
func (*Function) DesignDocFn ¶
func (f *Function) DesignDocFn() *DesignDocFn
type IndexStats ¶
type IndexStats struct { // Documents number of document in the index Documents uint64 // Keys number of keys in the index Keys uint64 // Used number of bytes used by the index Used uint64 // Allocated number of bytes allocated by the index Allocated uint64 }
IndexStats
Since an index may have multiple records pointing to the same document or may ignore documents, the number of Records may be higher than the number of Documents.
func (IndexStats) String ¶
func (s IndexStats) String() string
type IteratorOptions ¶
type Proxy ¶
type SearchIndexOption ¶
type SearchIndexOption struct { // Boost, a number that specifies the relevance in search results. // Content that is indexed with a boost value greater than // 1 is more relevant than content that is indexed without // a boost value. Content with a boost value less than one // is not so relevant. Value is a positive floating point // number. Default is 1 (no boosting). Boost int `json:"boost"` // Facet, creates a faceted index. See Faceting. Values are true // or false. Default is false. Facet bool `json:"facet"` // Index, whether the data is indexed, and if so, how. If set to // false, the data cannot be used for searches, but can still be // retrieved from the index if store is set to true. See Analyzers. // Values are true or false. Default is true Index *bool `json:"index"` // Store, if true, the value is returned in the search result; // otherwise, the value is not returned. Values are true or false. // Default is false. Store bool `json:"store"` }
func (SearchIndexOption) ShouldIndex ¶
func (o SearchIndexOption) ShouldIndex() bool
Returns true when the data should be indexed
type Security ¶
func DefaultSecurity ¶
func DefaultSecurity() *Security
type SelectorGroup ¶
type SelectorGroup struct { Members []SelectorQuery Operation SelectorGroupOp }
func (SelectorGroup) Match ¶
func (sg SelectorGroup) Match(df DocumentField) (bool, error)
func (SelectorGroup) String ¶
func (sg SelectorGroup) String() string
func (*SelectorGroup) UnmarshalJSON ¶
func (sg *SelectorGroup) UnmarshalJSON(blob []byte) error
type SelectorGroupOp ¶
type SelectorGroupOp string
const ( SelectorAnd SelectorGroupOp = "$and" // Matches if all the selectors in the array match. SelectorOr SelectorGroupOp = "$or" // Matches if any of the selectors in the array match. All selectors must use the same index. SelectorNot SelectorGroupOp = "$not" // Matches if the given selector does not match. SelectorNor SelectorGroupOp = "$nor" // Matches if none of the selectors in the array match. SelectorElemMatch SelectorGroupOp = "$elemMatch" // Matches and returns all documents that contain an array field with at least one element that matches all the specified query criteria. SelectorAllMatch SelectorGroupOp = "$allMatch" // Matches and returns all documents that contain an array field with all its elements matching all the specified query criteria. SelectorKeyMapMatch SelectorGroupOp = "$keyMapMatch" // Matches and returns all documents that contain a map that contains at least one key that matches all the specified query criteria. )
type SelectorOp ¶
type SelectorOp string
const ( SelectorOpLt SelectorOp = "$lt" // The field is less than the argument SelectorOpLte SelectorOp = "$lte" // The field is less than or equal to the argument. SelectorOpEq SelectorOp = "$eq" // The field is equal to the argument SelectorOpNe SelectorOp = "$ne" // The field is not equal to the argument. SelectorOpGte SelectorOp = "$gte" // The field is greater than or equal to the argument. SelectorOpGt SelectorOp = "$gt" // The field is greater than the to the argument. SelectorOpExists SelectorOp = "$exists" // Check whether the field exists or not, regardless of its value. SelectorOpType SelectorOp = "$type" // Check the document field’s type. Valid values are "null", "boolean", "number", "string", "array", and "object". SelectorOpIn SelectorOp = "$in" // The document field must exist in the list provided. SelectorOpNin SelectorOp = "$nin" // The document field not must exist in the list provided. SelectorOpSize SelectorOp = "$size" // Special condition to match the length of an array field in a document. Non-array fields cannot match this condition. SelectorOpMod SelectorOp = "$mod" // Divisor and Remainder are both positive or negative integers. Non-integer values result in a 404. Matches documents where field % Divisor == Remainder is true, and only when the document field is an integer. SelectorOpRegex SelectorOp = "$regex" // A regular expression pattern to match against the document field. Only matches when the field is a string value and matches the supplied regular expression. The matching algorithms are based on the Perl Compatible Regular Expression (PCRE) library. For more information about what is implemented, see the see the https://golang.org/pkg/regexp/ SelectorAll SelectorOp = "$all" // Matches an array value if it contains all the elements of the argument array. )
type SelectorQuery ¶
type SelectorQuery interface { // Match returns true if the selector matched // the passed otherwise false Match(df DocumentField) (bool, error) String() string }
SelectorQuery matches a document or doesn't
type SelectorValue ¶
type SelectorValue struct {
// contains filtered or unexported fields
}
func (SelectorValue) ArrayLen ¶
func (sv SelectorValue) ArrayLen() int
func (*SelectorValue) GeaterThen ¶
func (sv *SelectorValue) GeaterThen(other *SelectorValue) bool
func (*SelectorValue) IsNumber ¶
func (sv *SelectorValue) IsNumber() bool
func (*SelectorValue) LessThen ¶
func (sv *SelectorValue) LessThen(other *SelectorValue) bool
func (*SelectorValue) Match ¶
func (sv *SelectorValue) Match(other *SelectorValue) (bool, error)
func (*SelectorValue) Set ¶
func (sv *SelectorValue) Set(v interface{})
func (*SelectorValue) Type ¶
func (sv *SelectorValue) Type() string
func (SelectorValue) Values ¶
func (sv SelectorValue) Values() []SelectorValue
type SelectorValueType ¶
type SelectorValueType int
type Task ¶
type User ¶
type User struct { Name string `mapstructure:"name" json:"name"` Roles []string `mapstructure:"roles" json:"roles"` Type string `mapstructure:"type" json:"type"` Password string `mapstructure:"password" json:"password"` PasswordScheme string `mapstructure:"password_scheme" json:"password_scheme"` Iterations int `mapstructure:"iterations" json:"iterations"` DerivedKey string `mapstructure:"derived_key" json:"derived_key"` Salt string `mapstructure:"salt" json:"salt"` }
func (*User) FromDocument ¶
func (*User) GeneratePBKDF2 ¶
GeneratePBKDF2 generates a pbkdf in a couchdb compatible fashion
type VirtualHostConfiguration ¶
type VirtualHostConfiguration struct { Name string Rev string Domains []string `mapstructure:"domains" json:"domains"` Proxy map[string]Proxy `mapstructure:"proxy" json:"proxy"` Static string `mapstructure:"static" json:"static"` FS http.FileSystem }
func (VirtualHostConfiguration) Open ¶
func (c VirtualHostConfiguration) Open(name string) (http.File, error)
func (VirtualHostConfiguration) String ¶
func (c VirtualHostConfiguration) String() string
Click to show internal directories.
Click to hide internal directories.