Documentation
¶
Index ¶
- Constants
- type CensusClient
- type CensusLanguage
- type Query
- func (q *Query) AddResolve(resolves ...string) *Query
- func (q *Query) GetResults() ([]byte, error)
- func (q *Query) GetResultsBatch() ([]byte, error)
- func (q *Query) GetURL() string
- func (q *Query) HideFields(fields ...string) *Query
- func (q *Query) JoinCollection(collection string) *queryJoin
- func (q *Query) SetLanguage(language CensusLanguage) *Query
- func (q *Query) SetLanguageString(language string) *Query
- func (q *Query) SetLimit(limit int) *Query
- func (q *Query) SetStart(start int) *Query
- func (q *Query) ShowFields(fields ...string) *Query
- func (q *Query) String() string
- func (q *Query) TreeField(field string) *queryTree
- func (q *Query) Where(field string) *queryOperand
- type QueryBuilder
Constants ¶
const VERSION = "1.2.0"
VERSION for semver
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CensusClient ¶
type CensusClient struct {
// contains filtered or unexported fields
}
CensusClient is an object that retains a client and census configuration states between generated queries
func NewCensusClient ¶
func NewCensusClient(serviceID string, collectionNamespace string) *CensusClient
NewCensusClient creates a CensusClient object
type CensusLanguage ¶
type CensusLanguage int
const ( LangEnglish CensusLanguage = iota LangGerman LangSpanish LangFrench LangItalian LangTurkish )
type Query ¶ added in v1.1.0
type Query struct {
Collection string
ExactMatchFirst bool `queryProp:"exactMatchFirst"`
Timing bool `queryProp:"timing"`
IncludeNull bool `queryProp:"includeNull"`
CaseSensitive bool `queryProp:"case,default=true"`
Retry bool `queryProp:"retry,default=true"`
Limit int `queryProp:"limit,default=-1"`
LimitPerDB int `queryProp:"limitPerDB,default=-1"`
Start int `queryProp:"start,default=-1"`
Show []string `queryProp:"show"`
Hide []string `queryProp:"hide"`
Sort []string `queryProp:"sort"`
Has []string `queryProp:"has"`
Resolve []string `queryProp:"resolve"`
Join []*queryJoin `queryProp:"join"`
Tree []*queryTree `queryProp:"tree"`
Distinct string `queryProp:"distinct"`
Language string `queryProp:"lang"`
// contains filtered or unexported fields
}
Query is the expression root for a census query
func NewQuery ¶ added in v1.1.0
func NewQuery(collection string, censusClient *CensusClient) *Query
NewQuery creates a new Query object
func (*Query) AddResolve ¶ added in v1.1.0
AddResolve adds resolution effects to the query
func (*Query) GetResults ¶ added in v1.1.0
GetResults returns the records from the census API as stated in the query expression
func (*Query) GetResultsBatch ¶ added in v1.1.0
GetResultsBatch returns ALL records from the census API as stated in the query expression in batches
func (*Query) HideFields ¶ added in v1.1.0
HideFields lists the specific fields to exclude from each record
func (*Query) JoinCollection ¶ added in v1.1.0
JoinCollection joins the query with another collection
func (*Query) SetLanguage ¶ added in v1.1.0
func (q *Query) SetLanguage(language CensusLanguage) *Query
SetLanguage sets the localization string set to only return a specific language
func (*Query) SetLanguageString ¶ added in v1.1.0
SetLanguageString sets the localization string set to only return a specific language
func (*Query) SetStart ¶ added in v1.1.0
SetStart sets the record to begin the query from if the collection isn't stored in a cluster
func (*Query) ShowFields ¶ added in v1.1.0
ShowFields lists the specific fields to include from each record
type QueryBuilder ¶
type QueryBuilder struct {
CensusClient *CensusClient
}
QueryBuilder is a factory used to generate census queries that share the same census service ID and collection namespace
func NewQueryBuilder ¶
func NewQueryBuilder(serviceID string, collectionNamespace string) *QueryBuilder
NewQueryBuilder returns a new QueryBuilder object
func (*QueryBuilder) NewQuery ¶
func (b *QueryBuilder) NewQuery(collection string) *Query
NewQuery creates a new census query expression