repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
algolia/algoliasearch-client-go
algolia/search/index.go
Delete
func (i *Index) Delete(opts ...interface{}) (res DeleteTaskRes, err error) { path := i.path("") err = i.transport.Request(&res, http.MethodDelete, path, nil, call.Write, opts...) res.wait = i.WaitTask return }
go
func (i *Index) Delete(opts ...interface{}) (res DeleteTaskRes, err error) { path := i.path("") err = i.transport.Request(&res, http.MethodDelete, path, nil, call.Write, opts...) res.wait = i.WaitTask return }
[ "func", "(", "i", "*", "Index", ")", "Delete", "(", "opts", "...", "interface", "{", "}", ")", "(", "res", "DeleteTaskRes", ",", "err", "error", ")", "{", "path", ":=", "i", ".", "path", "(", "\"", "\"", ")", "\n", "err", "=", "i", ".", "transport", ".", "Request", "(", "&", "res", ",", "http", ".", "MethodDelete", ",", "path", ",", "nil", ",", "call", ".", "Write", ",", "opts", "...", ")", "\n", "res", ".", "wait", "=", "i", ".", "WaitTask", "\n", "return", "\n", "}" ]
// Delete removes the entire index. After this call, new indexing calls can be // sent with the same index instance.
[ "Delete", "removes", "the", "entire", "index", ".", "After", "this", "call", "new", "indexing", "calls", "can", "be", "sent", "with", "the", "same", "index", "instance", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index.go#L85-L90
train
algolia/algoliasearch-client-go
algolia/search/index.go
GetStatus
func (i *Index) GetStatus(taskID int) (res TaskStatusRes, err error) { path := i.path("/task/%d", taskID) err = i.transport.Request(&res, http.MethodGet, path, nil, call.Read) return }
go
func (i *Index) GetStatus(taskID int) (res TaskStatusRes, err error) { path := i.path("/task/%d", taskID) err = i.transport.Request(&res, http.MethodGet, path, nil, call.Read) return }
[ "func", "(", "i", "*", "Index", ")", "GetStatus", "(", "taskID", "int", ")", "(", "res", "TaskStatusRes", ",", "err", "error", ")", "{", "path", ":=", "i", ".", "path", "(", "\"", "\"", ",", "taskID", ")", "\n", "err", "=", "i", ".", "transport", ".", "Request", "(", "&", "res", ",", "http", ".", "MethodGet", ",", "path", ",", "nil", ",", "call", ".", "Read", ")", "\n", "return", "\n", "}" ]
// GetStatus retrieves the task status according to the Algolia engine for the // given task.
[ "GetStatus", "retrieves", "the", "task", "status", "according", "to", "the", "Algolia", "engine", "for", "the", "given", "task", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index.go#L94-L98
train
algolia/algoliasearch-client-go
algolia/iterator/iterator.go
New
func New(itf interface{}) Iterator { // First, if the given interface already is an iterator.Iterator, // we return it as-is. if it, ok := itf.(Iterator); ok { return it } value := reflect.ValueOf(itf) switch value.Kind() { case reflect.Array, reflect.Slice: // In case the objects are sent as a slice or an array, we iterate over // them to produce a []interface{} which we then wrap on an // iterator.sliceIterator. var slice []interface{} for i := 0; i < value.Len(); i++ { slice = append(slice, value.Index(i).Interface()) } return newIteratorFromSlice(slice) default: // Otherwise, the objects is most probably a single object. In that case, // we consider it as a single object and produce a slice with this object // as the sole element, which we also wrap in an iterator.Iterator. return newIteratorFromSlice([]interface{}{itf}) } }
go
func New(itf interface{}) Iterator { // First, if the given interface already is an iterator.Iterator, // we return it as-is. if it, ok := itf.(Iterator); ok { return it } value := reflect.ValueOf(itf) switch value.Kind() { case reflect.Array, reflect.Slice: // In case the objects are sent as a slice or an array, we iterate over // them to produce a []interface{} which we then wrap on an // iterator.sliceIterator. var slice []interface{} for i := 0; i < value.Len(); i++ { slice = append(slice, value.Index(i).Interface()) } return newIteratorFromSlice(slice) default: // Otherwise, the objects is most probably a single object. In that case, // we consider it as a single object and produce a slice with this object // as the sole element, which we also wrap in an iterator.Iterator. return newIteratorFromSlice([]interface{}{itf}) } }
[ "func", "New", "(", "itf", "interface", "{", "}", ")", "Iterator", "{", "// First, if the given interface already is an iterator.Iterator,", "// we return it as-is.", "if", "it", ",", "ok", ":=", "itf", ".", "(", "Iterator", ")", ";", "ok", "{", "return", "it", "\n", "}", "\n\n", "value", ":=", "reflect", ".", "ValueOf", "(", "itf", ")", "\n", "switch", "value", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Array", ",", "reflect", ".", "Slice", ":", "// In case the objects are sent as a slice or an array, we iterate over", "// them to produce a []interface{} which we then wrap on an", "// iterator.sliceIterator.", "var", "slice", "[", "]", "interface", "{", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "value", ".", "Len", "(", ")", ";", "i", "++", "{", "slice", "=", "append", "(", "slice", ",", "value", ".", "Index", "(", "i", ")", ".", "Interface", "(", ")", ")", "\n", "}", "\n", "return", "newIteratorFromSlice", "(", "slice", ")", "\n", "default", ":", "// Otherwise, the objects is most probably a single object. In that case,", "// we consider it as a single object and produce a slice with this object", "// as the sole element, which we also wrap in an iterator.Iterator.", "return", "newIteratorFromSlice", "(", "[", "]", "interface", "{", "}", "{", "itf", "}", ")", "\n", "}", "\n", "}" ]
// New is used to produce an `iterator.Iterator` out of Go arrays or slices or // any object instance implementing the `iterator.Iterator`. For now, Go // channels and maps are not supported.
[ "New", "is", "used", "to", "produce", "an", "iterator", ".", "Iterator", "out", "of", "Go", "arrays", "or", "slices", "or", "any", "object", "instance", "implementing", "the", "iterator", ".", "Iterator", ".", "For", "now", "Go", "channels", "and", "maps", "are", "not", "supported", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/iterator/iterator.go#L18-L42
train
algolia/algoliasearch-client-go
algolia/internal/opt/disable_prefix_on_attributes.go
ExtractDisablePrefixOnAttributes
func ExtractDisablePrefixOnAttributes(opts ...interface{}) *opt.DisablePrefixOnAttributesOption { for _, o := range opts { if v, ok := o.(*opt.DisablePrefixOnAttributesOption); ok { return v } } return nil }
go
func ExtractDisablePrefixOnAttributes(opts ...interface{}) *opt.DisablePrefixOnAttributesOption { for _, o := range opts { if v, ok := o.(*opt.DisablePrefixOnAttributesOption); ok { return v } } return nil }
[ "func", "ExtractDisablePrefixOnAttributes", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "DisablePrefixOnAttributesOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "DisablePrefixOnAttributesOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractDisablePrefixOnAttributes returns the first found DisablePrefixOnAttributesOption from the // given variadic arguments or nil otherwise.
[ "ExtractDisablePrefixOnAttributes", "returns", "the", "first", "found", "DisablePrefixOnAttributesOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/disable_prefix_on_attributes.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/min_word_sizefor1_typo.go
ExtractMinWordSizefor1Typo
func ExtractMinWordSizefor1Typo(opts ...interface{}) *opt.MinWordSizefor1TypoOption { for _, o := range opts { if v, ok := o.(*opt.MinWordSizefor1TypoOption); ok { return v } } return nil }
go
func ExtractMinWordSizefor1Typo(opts ...interface{}) *opt.MinWordSizefor1TypoOption { for _, o := range opts { if v, ok := o.(*opt.MinWordSizefor1TypoOption); ok { return v } } return nil }
[ "func", "ExtractMinWordSizefor1Typo", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "MinWordSizefor1TypoOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "MinWordSizefor1TypoOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractMinWordSizefor1Typo returns the first found MinWordSizefor1TypoOption from the // given variadic arguments or nil otherwise.
[ "ExtractMinWordSizefor1Typo", "returns", "the", "first", "found", "MinWordSizefor1TypoOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/min_word_sizefor1_typo.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/type.go
TypeEqual
func TypeEqual(o1, o2 *TypeOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func TypeEqual(o1, o2 *TypeOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "TypeEqual", "(", "o1", ",", "o2", "*", "TypeOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// TypeEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "TypeEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/type.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/numeric_attributes_for_filtering.go
NumericAttributesForFilteringEqual
func NumericAttributesForFilteringEqual(o1, o2 *NumericAttributesForFilteringOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func NumericAttributesForFilteringEqual(o1, o2 *NumericAttributesForFilteringOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "NumericAttributesForFilteringEqual", "(", "o1", ",", "o2", "*", "NumericAttributesForFilteringOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// NumericAttributesForFilteringEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "NumericAttributesForFilteringEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/numeric_attributes_for_filtering.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/opt/decompounded_attributes.go
DecompoundedAttributesEqual
func DecompoundedAttributesEqual(o1, o2 *DecompoundedAttributesOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func DecompoundedAttributesEqual(o1, o2 *DecompoundedAttributesOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "DecompoundedAttributesEqual", "(", "o1", ",", "o2", "*", "DecompoundedAttributesOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// DecompoundedAttributesEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "DecompoundedAttributesEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/decompounded_attributes.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/opt/replace_synonyms_in_highlight.go
ReplaceSynonymsInHighlightEqual
func ReplaceSynonymsInHighlightEqual(o1, o2 *ReplaceSynonymsInHighlightOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func ReplaceSynonymsInHighlightEqual(o1, o2 *ReplaceSynonymsInHighlightOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "ReplaceSynonymsInHighlightEqual", "(", "o1", ",", "o2", "*", "ReplaceSynonymsInHighlightOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// ReplaceSynonymsInHighlightEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "ReplaceSynonymsInHighlightEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/replace_synonyms_in_highlight.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/internal/opt/optional_filters.go
ExtractOptionalFilters
func ExtractOptionalFilters(opts ...interface{}) *opt.OptionalFiltersOption { for _, o := range opts { if v, ok := o.(*opt.OptionalFiltersOption); ok { return v } } return nil }
go
func ExtractOptionalFilters(opts ...interface{}) *opt.OptionalFiltersOption { for _, o := range opts { if v, ok := o.(*opt.OptionalFiltersOption); ok { return v } } return nil }
[ "func", "ExtractOptionalFilters", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "OptionalFiltersOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "OptionalFiltersOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractOptionalFilters returns the first found OptionalFiltersOption from the // given variadic arguments or nil otherwise.
[ "ExtractOptionalFilters", "returns", "the", "first", "found", "OptionalFiltersOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/optional_filters.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/primary.go
ExtractPrimary
func ExtractPrimary(opts ...interface{}) *opt.PrimaryOption { for _, o := range opts { if v, ok := o.(*opt.PrimaryOption); ok { return v } } return nil }
go
func ExtractPrimary(opts ...interface{}) *opt.PrimaryOption { for _, o := range opts { if v, ok := o.(*opt.PrimaryOption); ok { return v } } return nil }
[ "func", "ExtractPrimary", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "PrimaryOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "PrimaryOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractPrimary returns the first found PrimaryOption from the // given variadic arguments or nil otherwise.
[ "ExtractPrimary", "returns", "the", "first", "found", "PrimaryOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/primary.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/valid_until.go
ExtractValidUntil
func ExtractValidUntil(opts ...interface{}) *opt.ValidUntilOption { for _, o := range opts { if v, ok := o.(*opt.ValidUntilOption); ok { return v } } return nil }
go
func ExtractValidUntil(opts ...interface{}) *opt.ValidUntilOption { for _, o := range opts { if v, ok := o.(*opt.ValidUntilOption); ok { return v } } return nil }
[ "func", "ExtractValidUntil", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "ValidUntilOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "ValidUntilOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractValidUntil returns the first found ValidUntilOption from the // given variadic arguments or nil otherwise.
[ "ExtractValidUntil", "returns", "the", "first", "found", "ValidUntilOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/valid_until.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/minimum_around_radius.go
ExtractMinimumAroundRadius
func ExtractMinimumAroundRadius(opts ...interface{}) *opt.MinimumAroundRadiusOption { for _, o := range opts { if v, ok := o.(*opt.MinimumAroundRadiusOption); ok { return v } } return nil }
go
func ExtractMinimumAroundRadius(opts ...interface{}) *opt.MinimumAroundRadiusOption { for _, o := range opts { if v, ok := o.(*opt.MinimumAroundRadiusOption); ok { return v } } return nil }
[ "func", "ExtractMinimumAroundRadius", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "MinimumAroundRadiusOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "MinimumAroundRadiusOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractMinimumAroundRadius returns the first found MinimumAroundRadiusOption from the // given variadic arguments or nil otherwise.
[ "ExtractMinimumAroundRadius", "returns", "the", "first", "found", "MinimumAroundRadiusOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/minimum_around_radius.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/extra_url_params.go
ExtractExtraURLParams
func ExtractExtraURLParams(opts ...interface{}) *opt.ExtraURLParamsOption { merged := make(map[string]string) for _, o := range opts { if v, ok := o.(*opt.ExtraURLParamsOption); ok { for key, value := range v.Get() { merged[key] = value } } } if len(merged) == 0 { return nil } return opt.ExtraURLParams(merged) }
go
func ExtractExtraURLParams(opts ...interface{}) *opt.ExtraURLParamsOption { merged := make(map[string]string) for _, o := range opts { if v, ok := o.(*opt.ExtraURLParamsOption); ok { for key, value := range v.Get() { merged[key] = value } } } if len(merged) == 0 { return nil } return opt.ExtraURLParams(merged) }
[ "func", "ExtractExtraURLParams", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "ExtraURLParamsOption", "{", "merged", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n\n", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "ExtraURLParamsOption", ")", ";", "ok", "{", "for", "key", ",", "value", ":=", "range", "v", ".", "Get", "(", ")", "{", "merged", "[", "key", "]", "=", "value", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "merged", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "return", "opt", ".", "ExtraURLParams", "(", "merged", ")", "\n", "}" ]
// ExtractExtraURLParams returns the first found ExtraURLParamsOption from the // given variadic arguments or nil otherwise. If multiple options are found, the // inner maps are merged.
[ "ExtractExtraURLParams", "returns", "the", "first", "found", "ExtraURLParamsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", ".", "If", "multiple", "options", "are", "found", "the", "inner", "maps", "are", "merged", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/extra_url_params.go#L12-L28
train
algolia/algoliasearch-client-go
algolia/internal/opt/clear_existing_rules.go
ExtractClearExistingRules
func ExtractClearExistingRules(opts ...interface{}) *opt.ClearExistingRulesOption { for _, o := range opts { if v, ok := o.(*opt.ClearExistingRulesOption); ok { return v } } return nil }
go
func ExtractClearExistingRules(opts ...interface{}) *opt.ClearExistingRulesOption { for _, o := range opts { if v, ok := o.(*opt.ClearExistingRulesOption); ok { return v } } return nil }
[ "func", "ExtractClearExistingRules", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "ClearExistingRulesOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "ClearExistingRulesOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractClearExistingRules returns the first found ClearExistingRulesOption from the // given variadic arguments or nil otherwise.
[ "ExtractClearExistingRules", "returns", "the", "first", "found", "ClearExistingRulesOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/clear_existing_rules.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/around_radius.go
MarshalJSON
func (o AroundRadiusOption) MarshalJSON() ([]byte, error) { if o.isAll { return []byte(`"all"`), nil } if o.meters != 0 { return []byte(fmt.Sprintf("%d", o.meters)), nil } return []byte("null"), nil }
go
func (o AroundRadiusOption) MarshalJSON() ([]byte, error) { if o.isAll { return []byte(`"all"`), nil } if o.meters != 0 { return []byte(fmt.Sprintf("%d", o.meters)), nil } return []byte("null"), nil }
[ "func", "(", "o", "AroundRadiusOption", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "o", ".", "isAll", "{", "return", "[", "]", "byte", "(", "`\"all\"`", ")", ",", "nil", "\n", "}", "\n\n", "if", "o", ".", "meters", "!=", "0", "{", "return", "[", "]", "byte", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "o", ".", "meters", ")", ")", ",", "nil", "\n", "}", "\n\n", "return", "[", "]", "byte", "(", "\"", "\"", ")", ",", "nil", "\n", "}" ]
// MarshalJSON implements the json.Marshaler interface for // AroundRadiusOption.
[ "MarshalJSON", "implements", "the", "json", ".", "Marshaler", "interface", "for", "AroundRadiusOption", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/around_radius.go#L38-L48
train
algolia/algoliasearch-client-go
algolia/opt/around_radius.go
UnmarshalJSON
func (o *AroundRadiusOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { return nil } var meters int if err := json.Unmarshal(data, &meters); err == nil { o.meters = meters return nil } var all string if err := json.Unmarshal(data, &all); err == nil && all == "all" { o.isAll = true return nil } return errs.ErrJSONDecode(data, "AroundRadiusOption") }
go
func (o *AroundRadiusOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { return nil } var meters int if err := json.Unmarshal(data, &meters); err == nil { o.meters = meters return nil } var all string if err := json.Unmarshal(data, &all); err == nil && all == "all" { o.isAll = true return nil } return errs.ErrJSONDecode(data, "AroundRadiusOption") }
[ "func", "(", "o", "*", "AroundRadiusOption", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "if", "string", "(", "data", ")", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "var", "meters", "int", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "meters", ")", ";", "err", "==", "nil", "{", "o", ".", "meters", "=", "meters", "\n", "return", "nil", "\n", "}", "\n\n", "var", "all", "string", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "all", ")", ";", "err", "==", "nil", "&&", "all", "==", "\"", "\"", "{", "o", ".", "isAll", "=", "true", "\n", "return", "nil", "\n", "}", "\n\n", "return", "errs", ".", "ErrJSONDecode", "(", "data", ",", "\"", "\"", ")", "\n", "}" ]
// UnmarshalJSON implements the json.Unmarshaler interface for // AroundRadiusOption.
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "for", "AroundRadiusOption", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/around_radius.go#L52-L70
train
algolia/algoliasearch-client-go
algolia/opt/around_radius.go
AroundRadiusEqual
func AroundRadiusEqual(o1, o2 *AroundRadiusOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func AroundRadiusEqual(o1, o2 *AroundRadiusOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "AroundRadiusEqual", "(", "o1", ",", "o2", "*", "AroundRadiusOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// AroundRadiusEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "AroundRadiusEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/around_radius.go#L85-L93
train
algolia/algoliasearch-client-go
algolia/internal/opt/sum_or_filters_scores.go
ExtractSumOrFiltersScores
func ExtractSumOrFiltersScores(opts ...interface{}) *opt.SumOrFiltersScoresOption { for _, o := range opts { if v, ok := o.(*opt.SumOrFiltersScoresOption); ok { return v } } return nil }
go
func ExtractSumOrFiltersScores(opts ...interface{}) *opt.SumOrFiltersScoresOption { for _, o := range opts { if v, ok := o.(*opt.SumOrFiltersScoresOption); ok { return v } } return nil }
[ "func", "ExtractSumOrFiltersScores", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "SumOrFiltersScoresOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "SumOrFiltersScoresOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractSumOrFiltersScores returns the first found SumOrFiltersScoresOption from the // given variadic arguments or nil otherwise.
[ "ExtractSumOrFiltersScores", "returns", "the", "first", "found", "SumOrFiltersScoresOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/sum_or_filters_scores.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/replace_existing_synonyms.go
ExtractReplaceExistingSynonyms
func ExtractReplaceExistingSynonyms(opts ...interface{}) *opt.ReplaceExistingSynonymsOption { for _, o := range opts { if v, ok := o.(*opt.ReplaceExistingSynonymsOption); ok { return v } } return nil }
go
func ExtractReplaceExistingSynonyms(opts ...interface{}) *opt.ReplaceExistingSynonymsOption { for _, o := range opts { if v, ok := o.(*opt.ReplaceExistingSynonymsOption); ok { return v } } return nil }
[ "func", "ExtractReplaceExistingSynonyms", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "ReplaceExistingSynonymsOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "ReplaceExistingSynonymsOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractReplaceExistingSynonyms returns the first found ReplaceExistingSynonymsOption from the // given variadic arguments or nil otherwise.
[ "ExtractReplaceExistingSynonyms", "returns", "the", "first", "found", "ReplaceExistingSynonymsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/replace_existing_synonyms.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/decompounded_attributes.go
ExtractDecompoundedAttributes
func ExtractDecompoundedAttributes(opts ...interface{}) *opt.DecompoundedAttributesOption { for _, o := range opts { if v, ok := o.(*opt.DecompoundedAttributesOption); ok { return v } } return nil }
go
func ExtractDecompoundedAttributes(opts ...interface{}) *opt.DecompoundedAttributesOption { for _, o := range opts { if v, ok := o.(*opt.DecompoundedAttributesOption); ok { return v } } return nil }
[ "func", "ExtractDecompoundedAttributes", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "DecompoundedAttributesOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "DecompoundedAttributesOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractDecompoundedAttributes returns the first found DecompoundedAttributesOption from the // given variadic arguments or nil otherwise.
[ "ExtractDecompoundedAttributes", "returns", "the", "first", "found", "DecompoundedAttributesOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/decompounded_attributes.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/sum_or_filters_scores.go
SumOrFiltersScoresEqual
func SumOrFiltersScoresEqual(o1, o2 *SumOrFiltersScoresOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func SumOrFiltersScoresEqual(o1, o2 *SumOrFiltersScoresOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "SumOrFiltersScoresEqual", "(", "o1", ",", "o2", "*", "SumOrFiltersScoresOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// SumOrFiltersScoresEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "SumOrFiltersScoresEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/sum_or_filters_scores.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/query_languages.go
QueryLanguagesEqual
func QueryLanguagesEqual(o1, o2 *QueryLanguagesOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func QueryLanguagesEqual(o1, o2 *QueryLanguagesOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "QueryLanguagesEqual", "(", "o1", ",", "o2", "*", "QueryLanguagesOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// QueryLanguagesEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "QueryLanguagesEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/query_languages.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/opt/highlight_post_tag.go
HighlightPostTagEqual
func HighlightPostTagEqual(o1, o2 *HighlightPostTagOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func HighlightPostTagEqual(o1, o2 *HighlightPostTagOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "HighlightPostTagEqual", "(", "o1", ",", "o2", "*", "HighlightPostTagOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// HighlightPostTagEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "HighlightPostTagEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/highlight_post_tag.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/length.go
LengthEqual
func LengthEqual(o1, o2 *LengthOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func LengthEqual(o1, o2 *LengthOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "LengthEqual", "(", "o1", ",", "o2", "*", "LengthOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// LengthEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "LengthEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/length.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/internal/opt/replicas.go
ExtractReplicas
func ExtractReplicas(opts ...interface{}) *opt.ReplicasOption { for _, o := range opts { if v, ok := o.(*opt.ReplicasOption); ok { return v } } return nil }
go
func ExtractReplicas(opts ...interface{}) *opt.ReplicasOption { for _, o := range opts { if v, ok := o.(*opt.ReplicasOption); ok { return v } } return nil }
[ "func", "ExtractReplicas", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "ReplicasOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "ReplicasOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractReplicas returns the first found ReplicasOption from the // given variadic arguments or nil otherwise.
[ "ExtractReplicas", "returns", "the", "first", "found", "ReplicasOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/replicas.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/auto_generate_object_id_if_not_exist.go
AutoGenerateObjectIDIfNotExistEqual
func AutoGenerateObjectIDIfNotExistEqual(o1, o2 *AutoGenerateObjectIDIfNotExistOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func AutoGenerateObjectIDIfNotExistEqual(o1, o2 *AutoGenerateObjectIDIfNotExistOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "AutoGenerateObjectIDIfNotExistEqual", "(", "o1", ",", "o2", "*", "AutoGenerateObjectIDIfNotExistOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// AutoGenerateObjectIDIfNotExistEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "AutoGenerateObjectIDIfNotExistEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/auto_generate_object_id_if_not_exist.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/internal/opt/numeric_filters.go
ExtractNumericFilters
func ExtractNumericFilters(opts ...interface{}) *opt.NumericFiltersOption { for _, o := range opts { if v, ok := o.(*opt.NumericFiltersOption); ok { return v } } return nil }
go
func ExtractNumericFilters(opts ...interface{}) *opt.NumericFiltersOption { for _, o := range opts { if v, ok := o.(*opt.NumericFiltersOption); ok { return v } } return nil }
[ "func", "ExtractNumericFilters", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "NumericFiltersOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "NumericFiltersOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractNumericFilters returns the first found NumericFiltersOption from the // given variadic arguments or nil otherwise.
[ "ExtractNumericFilters", "returns", "the", "first", "found", "NumericFiltersOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/numeric_filters.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/custom_ranking.go
CustomRankingEqual
func CustomRankingEqual(o1, o2 *CustomRankingOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func CustomRankingEqual(o1, o2 *CustomRankingOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "CustomRankingEqual", "(", "o1", ",", "o2", "*", "CustomRankingOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// CustomRankingEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "CustomRankingEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/custom_ranking.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/internal/opt/analytics.go
ExtractAnalytics
func ExtractAnalytics(opts ...interface{}) *opt.AnalyticsOption { for _, o := range opts { if v, ok := o.(*opt.AnalyticsOption); ok { return v } } return nil }
go
func ExtractAnalytics(opts ...interface{}) *opt.AnalyticsOption { for _, o := range opts { if v, ok := o.(*opt.AnalyticsOption); ok { return v } } return nil }
[ "func", "ExtractAnalytics", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "AnalyticsOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "AnalyticsOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractAnalytics returns the first found AnalyticsOption from the // given variadic arguments or nil otherwise.
[ "ExtractAnalytics", "returns", "the", "first", "found", "AnalyticsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/analytics.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/filters.go
FiltersEqual
func FiltersEqual(o1, o2 *FiltersOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func FiltersEqual(o1, o2 *FiltersOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "FiltersEqual", "(", "o1", ",", "o2", "*", "FiltersOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// FiltersEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "FiltersEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/filters.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/min_word_sizefor1_typo.go
MinWordSizefor1TypoEqual
func MinWordSizefor1TypoEqual(o1, o2 *MinWordSizefor1TypoOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func MinWordSizefor1TypoEqual(o1, o2 *MinWordSizefor1TypoOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "MinWordSizefor1TypoEqual", "(", "o1", ",", "o2", "*", "MinWordSizefor1TypoOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// MinWordSizefor1TypoEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "MinWordSizefor1TypoEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/min_word_sizefor1_typo.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/distinct.go
UnmarshalJSON
func (o *DistinctOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { return nil } var i int if err := json.Unmarshal(data, &i); err == nil { o.value = i return nil } var b bool if err := json.Unmarshal(data, &b); err == nil { if b { o.value = 1 } else { o.value = 0 } return nil } return errs.ErrJSONDecode(data, "Distinct") }
go
func (o *DistinctOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { return nil } var i int if err := json.Unmarshal(data, &i); err == nil { o.value = i return nil } var b bool if err := json.Unmarshal(data, &b); err == nil { if b { o.value = 1 } else { o.value = 0 } return nil } return errs.ErrJSONDecode(data, "Distinct") }
[ "func", "(", "o", "*", "DistinctOption", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "if", "string", "(", "data", ")", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "var", "i", "int", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "i", ")", ";", "err", "==", "nil", "{", "o", ".", "value", "=", "i", "\n", "return", "nil", "\n", "}", "\n\n", "var", "b", "bool", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "b", ")", ";", "err", "==", "nil", "{", "if", "b", "{", "o", ".", "value", "=", "1", "\n", "}", "else", "{", "o", ".", "value", "=", "0", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "return", "errs", ".", "ErrJSONDecode", "(", "data", ",", "\"", "\"", ")", "\n", "}" ]
// UnmarshalJSON implements the json.Unmarshaler interface for // DistinctOption.
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "for", "DistinctOption", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/distinct.go#L44-L66
train
algolia/algoliasearch-client-go
algolia/opt/distinct.go
DistinctEqual
func DistinctEqual(o1, o2 *DistinctOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func DistinctEqual(o1, o2 *DistinctOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "DistinctEqual", "(", "o1", ",", "o2", "*", "DistinctOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// DistinctEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "DistinctEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/distinct.go#L81-L89
train
algolia/algoliasearch-client-go
algolia/opt/attributes_for_faceting.go
AttributesForFacetingEqual
func AttributesForFacetingEqual(o1, o2 *AttributesForFacetingOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func AttributesForFacetingEqual(o1, o2 *AttributesForFacetingOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "AttributesForFacetingEqual", "(", "o1", ",", "o2", "*", "AttributesForFacetingOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// AttributesForFacetingEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "AttributesForFacetingEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/attributes_for_faceting.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/internal/opt/camel_case_attributes.go
ExtractCamelCaseAttributes
func ExtractCamelCaseAttributes(opts ...interface{}) *opt.CamelCaseAttributesOption { for _, o := range opts { if v, ok := o.(*opt.CamelCaseAttributesOption); ok { return v } } return nil }
go
func ExtractCamelCaseAttributes(opts ...interface{}) *opt.CamelCaseAttributesOption { for _, o := range opts { if v, ok := o.(*opt.CamelCaseAttributesOption); ok { return v } } return nil }
[ "func", "ExtractCamelCaseAttributes", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "CamelCaseAttributesOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "CamelCaseAttributesOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractCamelCaseAttributes returns the first found CamelCaseAttributesOption from the // given variadic arguments or nil otherwise.
[ "ExtractCamelCaseAttributes", "returns", "the", "first", "found", "CamelCaseAttributesOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/camel_case_attributes.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/anchoring.go
AnchoringEqual
func AnchoringEqual(o1, o2 *AnchoringOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func AnchoringEqual(o1, o2 *AnchoringOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "AnchoringEqual", "(", "o1", ",", "o2", "*", "AnchoringOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// AnchoringEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "AnchoringEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/anchoring.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/internal/opt/custom_ranking.go
ExtractCustomRanking
func ExtractCustomRanking(opts ...interface{}) *opt.CustomRankingOption { for _, o := range opts { if v, ok := o.(*opt.CustomRankingOption); ok { return v } } return nil }
go
func ExtractCustomRanking(opts ...interface{}) *opt.CustomRankingOption { for _, o := range opts { if v, ok := o.(*opt.CustomRankingOption); ok { return v } } return nil }
[ "func", "ExtractCustomRanking", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "CustomRankingOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "CustomRankingOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractCustomRanking returns the first found CustomRankingOption from the // given variadic arguments or nil otherwise.
[ "ExtractCustomRanking", "returns", "the", "first", "found", "CustomRankingOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/custom_ranking.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/enable_personalization.go
ExtractEnablePersonalization
func ExtractEnablePersonalization(opts ...interface{}) *opt.EnablePersonalizationOption { for _, o := range opts { if v, ok := o.(*opt.EnablePersonalizationOption); ok { return v } } return nil }
go
func ExtractEnablePersonalization(opts ...interface{}) *opt.EnablePersonalizationOption { for _, o := range opts { if v, ok := o.(*opt.EnablePersonalizationOption); ok { return v } } return nil }
[ "func", "ExtractEnablePersonalization", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "EnablePersonalizationOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "EnablePersonalizationOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractEnablePersonalization returns the first found EnablePersonalizationOption from the // given variadic arguments or nil otherwise.
[ "ExtractEnablePersonalization", "returns", "the", "first", "found", "EnablePersonalizationOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/enable_personalization.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/ranking.go
RankingEqual
func RankingEqual(o1, o2 *RankingOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func RankingEqual(o1, o2 *RankingOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "RankingEqual", "(", "o1", ",", "o2", "*", "RankingOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// RankingEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "RankingEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/ranking.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/internal/opt/replace_synonyms_in_highlight.go
ExtractReplaceSynonymsInHighlight
func ExtractReplaceSynonymsInHighlight(opts ...interface{}) *opt.ReplaceSynonymsInHighlightOption { for _, o := range opts { if v, ok := o.(*opt.ReplaceSynonymsInHighlightOption); ok { return v } } return nil }
go
func ExtractReplaceSynonymsInHighlight(opts ...interface{}) *opt.ReplaceSynonymsInHighlightOption { for _, o := range opts { if v, ok := o.(*opt.ReplaceSynonymsInHighlightOption); ok { return v } } return nil }
[ "func", "ExtractReplaceSynonymsInHighlight", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "ReplaceSynonymsInHighlightOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "ReplaceSynonymsInHighlightOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractReplaceSynonymsInHighlight returns the first found ReplaceSynonymsInHighlightOption from the // given variadic arguments or nil otherwise.
[ "ExtractReplaceSynonymsInHighlight", "returns", "the", "first", "found", "ReplaceSynonymsInHighlightOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/replace_synonyms_in_highlight.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/analytics.go
UnmarshalJSON
func (o *AnalyticsOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { o.value = true return nil } return json.Unmarshal(data, &o.value) }
go
func (o *AnalyticsOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { o.value = true return nil } return json.Unmarshal(data, &o.value) }
[ "func", "(", "o", "*", "AnalyticsOption", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "if", "string", "(", "data", ")", "==", "\"", "\"", "{", "o", ".", "value", "=", "true", "\n", "return", "nil", "\n", "}", "\n", "return", "json", ".", "Unmarshal", "(", "data", ",", "&", "o", ".", "value", ")", "\n", "}" ]
// UnmarshalJSON implements the json.Unmarshaler interface for // AnalyticsOption.
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "for", "AnalyticsOption", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/analytics.go#L34-L40
train
algolia/algoliasearch-client-go
algolia/opt/analytics.go
AnalyticsEqual
func AnalyticsEqual(o1, o2 *AnalyticsOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func AnalyticsEqual(o1, o2 *AnalyticsOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "AnalyticsEqual", "(", "o1", ",", "o2", "*", "AnalyticsOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// AnalyticsEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "AnalyticsEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/analytics.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/clear_existing_rules.go
UnmarshalJSON
func (o *ClearExistingRulesOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { o.value = false return nil } return json.Unmarshal(data, &o.value) }
go
func (o *ClearExistingRulesOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { o.value = false return nil } return json.Unmarshal(data, &o.value) }
[ "func", "(", "o", "*", "ClearExistingRulesOption", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "if", "string", "(", "data", ")", "==", "\"", "\"", "{", "o", ".", "value", "=", "false", "\n", "return", "nil", "\n", "}", "\n", "return", "json", ".", "Unmarshal", "(", "data", ",", "&", "o", ".", "value", ")", "\n", "}" ]
// UnmarshalJSON implements the json.Unmarshaler interface for // ClearExistingRulesOption.
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "for", "ClearExistingRulesOption", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/clear_existing_rules.go#L34-L40
train
algolia/algoliasearch-client-go
algolia/opt/clear_existing_rules.go
ClearExistingRulesEqual
func ClearExistingRulesEqual(o1, o2 *ClearExistingRulesOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func ClearExistingRulesEqual(o1, o2 *ClearExistingRulesOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "ClearExistingRulesEqual", "(", "o1", ",", "o2", "*", "ClearExistingRulesOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// ClearExistingRulesEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "ClearExistingRulesEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/clear_existing_rules.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/camel_case_attributes.go
CamelCaseAttributesEqual
func CamelCaseAttributesEqual(o1, o2 *CamelCaseAttributesOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func CamelCaseAttributesEqual(o1, o2 *CamelCaseAttributesOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "CamelCaseAttributesEqual", "(", "o1", ",", "o2", "*", "CamelCaseAttributesOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// CamelCaseAttributesEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "CamelCaseAttributesEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/camel_case_attributes.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/opt/numeric_filters.go
NumericFiltersEqual
func NumericFiltersEqual(o1, o2 *NumericFiltersOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func NumericFiltersEqual(o1, o2 *NumericFiltersOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "NumericFiltersEqual", "(", "o1", ",", "o2", "*", "NumericFiltersOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// NumericFiltersEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "NumericFiltersEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/numeric_filters.go#L66-L74
train
algolia/algoliasearch-client-go
algolia/internal/opt/sort_facet_values_by.go
ExtractSortFacetValuesBy
func ExtractSortFacetValuesBy(opts ...interface{}) *opt.SortFacetValuesByOption { for _, o := range opts { if v, ok := o.(*opt.SortFacetValuesByOption); ok { return v } } return nil }
go
func ExtractSortFacetValuesBy(opts ...interface{}) *opt.SortFacetValuesByOption { for _, o := range opts { if v, ok := o.(*opt.SortFacetValuesByOption); ok { return v } } return nil }
[ "func", "ExtractSortFacetValuesBy", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "SortFacetValuesByOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "SortFacetValuesByOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractSortFacetValuesBy returns the first found SortFacetValuesByOption from the // given variadic arguments or nil otherwise.
[ "ExtractSortFacetValuesBy", "returns", "the", "first", "found", "SortFacetValuesByOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/sort_facet_values_by.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/search/index_objects.go
GetObject
func (i *Index) GetObject(objectID string, object interface{}, opts ...interface{}) error { if objectID == "" { return errs.ErrMissingObjectID } opts = opt.InsertExtraURLParam( opts, "attributesToRetrieve", strings.Join(iopt.ExtractAttributesToRetrieve(opts...).Get(), ","), ) path := i.path("/" + url.QueryEscape(objectID)) return i.transport.Request(&object, http.MethodGet, path, nil, call.Read, opts...) }
go
func (i *Index) GetObject(objectID string, object interface{}, opts ...interface{}) error { if objectID == "" { return errs.ErrMissingObjectID } opts = opt.InsertExtraURLParam( opts, "attributesToRetrieve", strings.Join(iopt.ExtractAttributesToRetrieve(opts...).Get(), ","), ) path := i.path("/" + url.QueryEscape(objectID)) return i.transport.Request(&object, http.MethodGet, path, nil, call.Read, opts...) }
[ "func", "(", "i", "*", "Index", ")", "GetObject", "(", "objectID", "string", ",", "object", "interface", "{", "}", ",", "opts", "...", "interface", "{", "}", ")", "error", "{", "if", "objectID", "==", "\"", "\"", "{", "return", "errs", ".", "ErrMissingObjectID", "\n", "}", "\n\n", "opts", "=", "opt", ".", "InsertExtraURLParam", "(", "opts", ",", "\"", "\"", ",", "strings", ".", "Join", "(", "iopt", ".", "ExtractAttributesToRetrieve", "(", "opts", "...", ")", ".", "Get", "(", ")", ",", "\"", "\"", ")", ",", ")", "\n\n", "path", ":=", "i", ".", "path", "(", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "objectID", ")", ")", "\n", "return", "i", ".", "transport", ".", "Request", "(", "&", "object", ",", "http", ".", "MethodGet", ",", "path", ",", "nil", ",", "call", ".", "Read", ",", "opts", "...", ")", "\n", "}" ]
// GetObject retrieves the record identified by the given objectID and // deserializes it into the object parameter.
[ "GetObject", "retrieves", "the", "record", "identified", "by", "the", "given", "objectID", "and", "deserializes", "it", "into", "the", "object", "parameter", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_objects.go#L21-L34
train
algolia/algoliasearch-client-go
algolia/search/index_objects.go
SaveObject
func (i *Index) SaveObject(object interface{}, opts ...interface{}) (res SaveObjectRes, err error) { path := i.path("") err = i.transport.Request(&res, http.MethodPost, path, object, call.Write, opts...) res.wait = i.WaitTask return }
go
func (i *Index) SaveObject(object interface{}, opts ...interface{}) (res SaveObjectRes, err error) { path := i.path("") err = i.transport.Request(&res, http.MethodPost, path, object, call.Write, opts...) res.wait = i.WaitTask return }
[ "func", "(", "i", "*", "Index", ")", "SaveObject", "(", "object", "interface", "{", "}", ",", "opts", "...", "interface", "{", "}", ")", "(", "res", "SaveObjectRes", ",", "err", "error", ")", "{", "path", ":=", "i", ".", "path", "(", "\"", "\"", ")", "\n", "err", "=", "i", ".", "transport", ".", "Request", "(", "&", "res", ",", "http", ".", "MethodPost", ",", "path", ",", "object", ",", "call", ".", "Write", ",", "opts", "...", ")", "\n", "res", ".", "wait", "=", "i", ".", "WaitTask", "\n", "return", "\n", "}" ]
// SaveObject saves the given object to the index.
[ "SaveObject", "saves", "the", "given", "object", "to", "the", "index", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_objects.go#L37-L42
train
algolia/algoliasearch-client-go
algolia/search/index_objects.go
PartialUpdateObject
func (i *Index) PartialUpdateObject(object interface{}, opts ...interface{}) (res UpdateTaskRes, err error) { objectID, ok := getObjectID(object) if !ok { err = errs.ErrMissingObjectID res.wait = noWait return } opts = opt.InsertExtraURLParam( opts, "createIfNotExists", iopt.ExtractCreateIfNotExists(opts...).Get(), ) path := i.path("/" + url.QueryEscape(objectID) + "/partial") err = i.transport.Request(&res, http.MethodPost, path, object, call.Write, opts...) res.wait = i.WaitTask return }
go
func (i *Index) PartialUpdateObject(object interface{}, opts ...interface{}) (res UpdateTaskRes, err error) { objectID, ok := getObjectID(object) if !ok { err = errs.ErrMissingObjectID res.wait = noWait return } opts = opt.InsertExtraURLParam( opts, "createIfNotExists", iopt.ExtractCreateIfNotExists(opts...).Get(), ) path := i.path("/" + url.QueryEscape(objectID) + "/partial") err = i.transport.Request(&res, http.MethodPost, path, object, call.Write, opts...) res.wait = i.WaitTask return }
[ "func", "(", "i", "*", "Index", ")", "PartialUpdateObject", "(", "object", "interface", "{", "}", ",", "opts", "...", "interface", "{", "}", ")", "(", "res", "UpdateTaskRes", ",", "err", "error", ")", "{", "objectID", ",", "ok", ":=", "getObjectID", "(", "object", ")", "\n", "if", "!", "ok", "{", "err", "=", "errs", ".", "ErrMissingObjectID", "\n", "res", ".", "wait", "=", "noWait", "\n", "return", "\n", "}", "\n\n", "opts", "=", "opt", ".", "InsertExtraURLParam", "(", "opts", ",", "\"", "\"", ",", "iopt", ".", "ExtractCreateIfNotExists", "(", "opts", "...", ")", ".", "Get", "(", ")", ",", ")", "\n\n", "path", ":=", "i", ".", "path", "(", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "objectID", ")", "+", "\"", "\"", ")", "\n", "err", "=", "i", ".", "transport", ".", "Request", "(", "&", "res", ",", "http", ".", "MethodPost", ",", "path", ",", "object", ",", "call", ".", "Write", ",", "opts", "...", ")", "\n", "res", ".", "wait", "=", "i", ".", "WaitTask", "\n", "return", "\n", "}" ]
// PartialUpdateObject replaces the object content of the given object according // to its respective objectID field.
[ "PartialUpdateObject", "replaces", "the", "object", "content", "of", "the", "given", "object", "according", "to", "its", "respective", "objectID", "field", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_objects.go#L46-L64
train
algolia/algoliasearch-client-go
algolia/search/index_objects.go
GetObjects
func (i *Index) GetObjects(objectIDs []string, objects interface{}, opts ...interface{}) error { var ( attributesToRetrieve = iopt.ExtractAttributesToRetrieve(opts...) requests = make([]getObjectsReq, len(objectIDs)) body = map[string]interface{}{"requests": requests} res = getObjectsRes{objects} ) for j, objectID := range objectIDs { requests[j] = getObjectsReq{ IndexName: i.name, ObjectID: objectID, AttributesToRetrieve: attributesToRetrieve, } } path := "/1/indexes/*/objects" return i.transport.Request(&res, http.MethodPost, path, body, call.Read, opts...) }
go
func (i *Index) GetObjects(objectIDs []string, objects interface{}, opts ...interface{}) error { var ( attributesToRetrieve = iopt.ExtractAttributesToRetrieve(opts...) requests = make([]getObjectsReq, len(objectIDs)) body = map[string]interface{}{"requests": requests} res = getObjectsRes{objects} ) for j, objectID := range objectIDs { requests[j] = getObjectsReq{ IndexName: i.name, ObjectID: objectID, AttributesToRetrieve: attributesToRetrieve, } } path := "/1/indexes/*/objects" return i.transport.Request(&res, http.MethodPost, path, body, call.Read, opts...) }
[ "func", "(", "i", "*", "Index", ")", "GetObjects", "(", "objectIDs", "[", "]", "string", ",", "objects", "interface", "{", "}", ",", "opts", "...", "interface", "{", "}", ")", "error", "{", "var", "(", "attributesToRetrieve", "=", "iopt", ".", "ExtractAttributesToRetrieve", "(", "opts", "...", ")", "\n", "requests", "=", "make", "(", "[", "]", "getObjectsReq", ",", "len", "(", "objectIDs", ")", ")", "\n", "body", "=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "requests", "}", "\n", "res", "=", "getObjectsRes", "{", "objects", "}", "\n", ")", "\n\n", "for", "j", ",", "objectID", ":=", "range", "objectIDs", "{", "requests", "[", "j", "]", "=", "getObjectsReq", "{", "IndexName", ":", "i", ".", "name", ",", "ObjectID", ":", "objectID", ",", "AttributesToRetrieve", ":", "attributesToRetrieve", ",", "}", "\n", "}", "\n\n", "path", ":=", "\"", "\"", "\n", "return", "i", ".", "transport", ".", "Request", "(", "&", "res", ",", "http", ".", "MethodPost", ",", "path", ",", "body", ",", "call", ".", "Read", ",", "opts", "...", ")", "\n", "}" ]
// GetObjects retrieves the records identified by the given objectIDs and // deserializes them into the objects parameter.
[ "GetObjects", "retrieves", "the", "records", "identified", "by", "the", "given", "objectIDs", "and", "deserializes", "them", "into", "the", "objects", "parameter", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_objects.go#L82-L100
train
algolia/algoliasearch-client-go
algolia/search/index_objects.go
DeleteObjects
func (i *Index) DeleteObjects(objectIDs []string, opts ...interface{}) (res BatchRes, err error) { objects := make([]interface{}, len(objectIDs)) for j, id := range objectIDs { objects[j] = map[string]string{"objectID": id} } var operations []BatchOperation if operations, err = newOperationBatch(objects, DeleteObject); err == nil { res, err = i.Batch(operations, opts...) } else { res.wait = noWait } return }
go
func (i *Index) DeleteObjects(objectIDs []string, opts ...interface{}) (res BatchRes, err error) { objects := make([]interface{}, len(objectIDs)) for j, id := range objectIDs { objects[j] = map[string]string{"objectID": id} } var operations []BatchOperation if operations, err = newOperationBatch(objects, DeleteObject); err == nil { res, err = i.Batch(operations, opts...) } else { res.wait = noWait } return }
[ "func", "(", "i", "*", "Index", ")", "DeleteObjects", "(", "objectIDs", "[", "]", "string", ",", "opts", "...", "interface", "{", "}", ")", "(", "res", "BatchRes", ",", "err", "error", ")", "{", "objects", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "objectIDs", ")", ")", "\n\n", "for", "j", ",", "id", ":=", "range", "objectIDs", "{", "objects", "[", "j", "]", "=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "id", "}", "\n", "}", "\n\n", "var", "operations", "[", "]", "BatchOperation", "\n", "if", "operations", ",", "err", "=", "newOperationBatch", "(", "objects", ",", "DeleteObject", ")", ";", "err", "==", "nil", "{", "res", ",", "err", "=", "i", ".", "Batch", "(", "operations", ",", "opts", "...", ")", "\n", "}", "else", "{", "res", ".", "wait", "=", "noWait", "\n", "}", "\n", "return", "\n", "}" ]
// DeleteObjects removes the records identified by the given objectIDs.
[ "DeleteObjects", "removes", "the", "records", "identified", "by", "the", "given", "objectIDs", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_objects.go#L137-L151
train
algolia/algoliasearch-client-go
algolia/search/index_objects.go
Batch
func (i *Index) Batch(operations []BatchOperation, opts ...interface{}) (res BatchRes, err error) { body := batchReq{Requests: operations} path := i.path("/batch") err = i.transport.Request(&res, http.MethodPost, path, body, call.Write, opts...) res.wait = i.WaitTask return }
go
func (i *Index) Batch(operations []BatchOperation, opts ...interface{}) (res BatchRes, err error) { body := batchReq{Requests: operations} path := i.path("/batch") err = i.transport.Request(&res, http.MethodPost, path, body, call.Write, opts...) res.wait = i.WaitTask return }
[ "func", "(", "i", "*", "Index", ")", "Batch", "(", "operations", "[", "]", "BatchOperation", ",", "opts", "...", "interface", "{", "}", ")", "(", "res", "BatchRes", ",", "err", "error", ")", "{", "body", ":=", "batchReq", "{", "Requests", ":", "operations", "}", "\n", "path", ":=", "i", ".", "path", "(", "\"", "\"", ")", "\n", "err", "=", "i", ".", "transport", ".", "Request", "(", "&", "res", ",", "http", ".", "MethodPost", ",", "path", ",", "body", ",", "call", ".", "Write", ",", "opts", "...", ")", "\n", "res", ".", "wait", "=", "i", ".", "WaitTask", "\n", "return", "\n", "}" ]
// Batch sends all the given indexing operations with a single call.
[ "Batch", "sends", "all", "the", "given", "indexing", "operations", "with", "a", "single", "call", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_objects.go#L198-L204
train
algolia/algoliasearch-client-go
algolia/search/index_objects.go
Search
func (i *Index) Search(query string, opts ...interface{}) (res QueryRes, err error) { body := searchReq{Params: transport.URLEncode(newSearchParams(query, opts...))} path := i.path("/query") err = i.transport.Request(&res, http.MethodPost, path, body, call.Read, opts...) return }
go
func (i *Index) Search(query string, opts ...interface{}) (res QueryRes, err error) { body := searchReq{Params: transport.URLEncode(newSearchParams(query, opts...))} path := i.path("/query") err = i.transport.Request(&res, http.MethodPost, path, body, call.Read, opts...) return }
[ "func", "(", "i", "*", "Index", ")", "Search", "(", "query", "string", ",", "opts", "...", "interface", "{", "}", ")", "(", "res", "QueryRes", ",", "err", "error", ")", "{", "body", ":=", "searchReq", "{", "Params", ":", "transport", ".", "URLEncode", "(", "newSearchParams", "(", "query", ",", "opts", "...", ")", ")", "}", "\n", "path", ":=", "i", ".", "path", "(", "\"", "\"", ")", "\n", "err", "=", "i", ".", "transport", ".", "Request", "(", "&", "res", ",", "http", ".", "MethodPost", ",", "path", ",", "body", ",", "call", ".", "Read", ",", "opts", "...", ")", "\n", "return", "\n", "}" ]
// Search performs a search query according to the given query string and any // given query parameter among all the index records.
[ "Search", "performs", "a", "search", "query", "according", "to", "the", "given", "query", "string", "and", "any", "given", "query", "parameter", "among", "all", "the", "index", "records", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_objects.go#L221-L226
train
algolia/algoliasearch-client-go
algolia/search/index_objects.go
SearchForFacetValues
func (i *Index) SearchForFacetValues(facet, query string, opts ...interface{}) (res SearchForFacetValuesRes, err error) { params := newSearchForFacetValuesParams(query, opts...) body := map[string]string{ "params": transport.URLEncode(params), } path := i.path("/facets/%s/query", facet) err = i.transport.Request(&res, http.MethodPost, path, body, call.Read, opts...) return }
go
func (i *Index) SearchForFacetValues(facet, query string, opts ...interface{}) (res SearchForFacetValuesRes, err error) { params := newSearchForFacetValuesParams(query, opts...) body := map[string]string{ "params": transport.URLEncode(params), } path := i.path("/facets/%s/query", facet) err = i.transport.Request(&res, http.MethodPost, path, body, call.Read, opts...) return }
[ "func", "(", "i", "*", "Index", ")", "SearchForFacetValues", "(", "facet", ",", "query", "string", ",", "opts", "...", "interface", "{", "}", ")", "(", "res", "SearchForFacetValuesRes", ",", "err", "error", ")", "{", "params", ":=", "newSearchForFacetValuesParams", "(", "query", ",", "opts", "...", ")", "\n", "body", ":=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "transport", ".", "URLEncode", "(", "params", ")", ",", "}", "\n", "path", ":=", "i", ".", "path", "(", "\"", "\"", ",", "facet", ")", "\n", "err", "=", "i", ".", "transport", ".", "Request", "(", "&", "res", ",", "http", ".", "MethodPost", ",", "path", ",", "body", ",", "call", ".", "Read", ",", "opts", "...", ")", "\n", "return", "\n", "}" ]
// SearchForFacetValues performs a search query according to the given query // string and any given parameter among the values of the given facet.
[ "SearchForFacetValues", "performs", "a", "search", "query", "according", "to", "the", "given", "query", "string", "and", "any", "given", "parameter", "among", "the", "values", "of", "the", "given", "facet", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_objects.go#L230-L238
train
algolia/algoliasearch-client-go
algolia/opt/attribute_for_distinct.go
AttributeForDistinctEqual
func AttributeForDistinctEqual(o1, o2 *AttributeForDistinctOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func AttributeForDistinctEqual(o1, o2 *AttributeForDistinctOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "AttributeForDistinctEqual", "(", "o1", ",", "o2", "*", "AttributeForDistinctOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// AttributeForDistinctEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "AttributeForDistinctEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/attribute_for_distinct.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/facet_filters.go
FacetFiltersEqual
func FacetFiltersEqual(o1, o2 *FacetFiltersOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func FacetFiltersEqual(o1, o2 *FacetFiltersOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "FacetFiltersEqual", "(", "o1", ",", "o2", "*", "FacetFiltersOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// FacetFiltersEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "FacetFiltersEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/facet_filters.go#L66-L74
train
algolia/algoliasearch-client-go
algolia/internal/opt/remove_stop_words.go
ExtractRemoveStopWords
func ExtractRemoveStopWords(opts ...interface{}) *opt.RemoveStopWordsOption { for _, o := range opts { if v, ok := o.(*opt.RemoveStopWordsOption); ok { return v } } return nil }
go
func ExtractRemoveStopWords(opts ...interface{}) *opt.RemoveStopWordsOption { for _, o := range opts { if v, ok := o.(*opt.RemoveStopWordsOption); ok { return v } } return nil }
[ "func", "ExtractRemoveStopWords", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "RemoveStopWordsOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "RemoveStopWordsOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractRemoveStopWords returns the first found RemoveStopWordsOption from the // given variadic arguments or nil otherwise.
[ "ExtractRemoveStopWords", "returns", "the", "first", "found", "RemoveStopWordsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/remove_stop_words.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/attribute_for_distinct.go
ExtractAttributeForDistinct
func ExtractAttributeForDistinct(opts ...interface{}) *opt.AttributeForDistinctOption { for _, o := range opts { if v, ok := o.(*opt.AttributeForDistinctOption); ok { return v } } return nil }
go
func ExtractAttributeForDistinct(opts ...interface{}) *opt.AttributeForDistinctOption { for _, o := range opts { if v, ok := o.(*opt.AttributeForDistinctOption); ok { return v } } return nil }
[ "func", "ExtractAttributeForDistinct", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "AttributeForDistinctOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "AttributeForDistinctOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractAttributeForDistinct returns the first found AttributeForDistinctOption from the // given variadic arguments or nil otherwise.
[ "ExtractAttributeForDistinct", "returns", "the", "first", "found", "AttributeForDistinctOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/attribute_for_distinct.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/remove_words_if_no_results.go
ExtractRemoveWordsIfNoResults
func ExtractRemoveWordsIfNoResults(opts ...interface{}) *opt.RemoveWordsIfNoResultsOption { for _, o := range opts { if v, ok := o.(*opt.RemoveWordsIfNoResultsOption); ok { return v } } return nil }
go
func ExtractRemoveWordsIfNoResults(opts ...interface{}) *opt.RemoveWordsIfNoResultsOption { for _, o := range opts { if v, ok := o.(*opt.RemoveWordsIfNoResultsOption); ok { return v } } return nil }
[ "func", "ExtractRemoveWordsIfNoResults", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "RemoveWordsIfNoResultsOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "RemoveWordsIfNoResultsOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractRemoveWordsIfNoResults returns the first found RemoveWordsIfNoResultsOption from the // given variadic arguments or nil otherwise.
[ "ExtractRemoveWordsIfNoResults", "returns", "the", "first", "found", "RemoveWordsIfNoResultsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/remove_words_if_no_results.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/click_analytics.go
ClickAnalyticsEqual
func ClickAnalyticsEqual(o1, o2 *ClickAnalyticsOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func ClickAnalyticsEqual(o1, o2 *ClickAnalyticsOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "ClickAnalyticsEqual", "(", "o1", ",", "o2", "*", "ClickAnalyticsOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// ClickAnalyticsEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "ClickAnalyticsEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/click_analytics.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/alternatives_as_exact.go
AlternativesAsExactEqual
func AlternativesAsExactEqual(o1, o2 *AlternativesAsExactOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func AlternativesAsExactEqual(o1, o2 *AlternativesAsExactOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "AlternativesAsExactEqual", "(", "o1", ",", "o2", "*", "AlternativesAsExactOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// AlternativesAsExactEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "AlternativesAsExactEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/alternatives_as_exact.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/internal/opt/rule_contexts.go
ExtractRuleContexts
func ExtractRuleContexts(opts ...interface{}) *opt.RuleContextsOption { for _, o := range opts { if v, ok := o.(*opt.RuleContextsOption); ok { return v } } return nil }
go
func ExtractRuleContexts(opts ...interface{}) *opt.RuleContextsOption { for _, o := range opts { if v, ok := o.(*opt.RuleContextsOption); ok { return v } } return nil }
[ "func", "ExtractRuleContexts", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "RuleContextsOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "RuleContextsOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractRuleContexts returns the first found RuleContextsOption from the // given variadic arguments or nil otherwise.
[ "ExtractRuleContexts", "returns", "the", "first", "found", "RuleContextsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/rule_contexts.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/min_proximity.go
MinProximityEqual
func MinProximityEqual(o1, o2 *MinProximityOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func MinProximityEqual(o1, o2 *MinProximityOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "MinProximityEqual", "(", "o1", ",", "o2", "*", "MinProximityOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// MinProximityEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "MinProximityEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/min_proximity.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/opt/max_facet_hits.go
MaxFacetHitsEqual
func MaxFacetHitsEqual(o1, o2 *MaxFacetHitsOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func MaxFacetHitsEqual(o1, o2 *MaxFacetHitsOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "MaxFacetHitsEqual", "(", "o1", ",", "o2", "*", "MaxFacetHitsOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// MaxFacetHitsEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "MaxFacetHitsEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/max_facet_hits.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/internal/opt/max_values_per_facet.go
ExtractMaxValuesPerFacet
func ExtractMaxValuesPerFacet(opts ...interface{}) *opt.MaxValuesPerFacetOption { for _, o := range opts { if v, ok := o.(*opt.MaxValuesPerFacetOption); ok { return v } } return nil }
go
func ExtractMaxValuesPerFacet(opts ...interface{}) *opt.MaxValuesPerFacetOption { for _, o := range opts { if v, ok := o.(*opt.MaxValuesPerFacetOption); ok { return v } } return nil }
[ "func", "ExtractMaxValuesPerFacet", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "MaxValuesPerFacetOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "MaxValuesPerFacetOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractMaxValuesPerFacet returns the first found MaxValuesPerFacetOption from the // given variadic arguments or nil otherwise.
[ "ExtractMaxValuesPerFacet", "returns", "the", "first", "found", "MaxValuesPerFacetOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/max_values_per_facet.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/highlight_post_tag.go
ExtractHighlightPostTag
func ExtractHighlightPostTag(opts ...interface{}) *opt.HighlightPostTagOption { for _, o := range opts { if v, ok := o.(*opt.HighlightPostTagOption); ok { return v } } return nil }
go
func ExtractHighlightPostTag(opts ...interface{}) *opt.HighlightPostTagOption { for _, o := range opts { if v, ok := o.(*opt.HighlightPostTagOption); ok { return v } } return nil }
[ "func", "ExtractHighlightPostTag", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "HighlightPostTagOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "HighlightPostTagOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractHighlightPostTag returns the first found HighlightPostTagOption from the // given variadic arguments or nil otherwise.
[ "ExtractHighlightPostTag", "returns", "the", "first", "found", "HighlightPostTagOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/highlight_post_tag.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/optional_words.go
ExtractOptionalWords
func ExtractOptionalWords(opts ...interface{}) *opt.OptionalWordsOption { for _, o := range opts { if v, ok := o.(*opt.OptionalWordsOption); ok { return v } } return nil }
go
func ExtractOptionalWords(opts ...interface{}) *opt.OptionalWordsOption { for _, o := range opts { if v, ok := o.(*opt.OptionalWordsOption); ok { return v } } return nil }
[ "func", "ExtractOptionalWords", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "OptionalWordsOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "OptionalWordsOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractOptionalWords returns the first found OptionalWordsOption from the // given variadic arguments or nil otherwise.
[ "ExtractOptionalWords", "returns", "the", "first", "found", "OptionalWordsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/optional_words.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/analytics_tags.go
ExtractAnalyticsTags
func ExtractAnalyticsTags(opts ...interface{}) *opt.AnalyticsTagsOption { for _, o := range opts { if v, ok := o.(*opt.AnalyticsTagsOption); ok { return v } } return nil }
go
func ExtractAnalyticsTags(opts ...interface{}) *opt.AnalyticsTagsOption { for _, o := range opts { if v, ok := o.(*opt.AnalyticsTagsOption); ok { return v } } return nil }
[ "func", "ExtractAnalyticsTags", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "AnalyticsTagsOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "AnalyticsTagsOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractAnalyticsTags returns the first found AnalyticsTagsOption from the // given variadic arguments or nil otherwise.
[ "ExtractAnalyticsTags", "returns", "the", "first", "found", "AnalyticsTagsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/analytics_tags.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/get_ranking_info.go
GetRankingInfoEqual
func GetRankingInfoEqual(o1, o2 *GetRankingInfoOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func GetRankingInfoEqual(o1, o2 *GetRankingInfoOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "GetRankingInfoEqual", "(", "o1", ",", "o2", "*", "GetRankingInfoOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// GetRankingInfoEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "GetRankingInfoEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/get_ranking_info.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/internal/opt/query.go
ExtractQuery
func ExtractQuery(opts ...interface{}) *opt.QueryOption { for _, o := range opts { if v, ok := o.(*opt.QueryOption); ok { return v } } return nil }
go
func ExtractQuery(opts ...interface{}) *opt.QueryOption { for _, o := range opts { if v, ok := o.(*opt.QueryOption); ok { return v } } return nil }
[ "func", "ExtractQuery", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "QueryOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "QueryOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractQuery returns the first found QueryOption from the // given variadic arguments or nil otherwise.
[ "ExtractQuery", "returns", "the", "first", "found", "QueryOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/query.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/forward_to_replicas.go
ExtractForwardToReplicas
func ExtractForwardToReplicas(opts ...interface{}) *opt.ForwardToReplicasOption { for _, o := range opts { if v, ok := o.(*opt.ForwardToReplicasOption); ok { return v } } return nil }
go
func ExtractForwardToReplicas(opts ...interface{}) *opt.ForwardToReplicasOption { for _, o := range opts { if v, ok := o.(*opt.ForwardToReplicasOption); ok { return v } } return nil }
[ "func", "ExtractForwardToReplicas", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "ForwardToReplicasOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "ForwardToReplicasOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractForwardToReplicas returns the first found ForwardToReplicasOption from the // given variadic arguments or nil otherwise.
[ "ExtractForwardToReplicas", "returns", "the", "first", "found", "ForwardToReplicasOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/forward_to_replicas.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/advanced.go
AdvancedEqual
func AdvancedEqual(o1, o2 *AdvancedOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func AdvancedEqual(o1, o2 *AdvancedOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "AdvancedEqual", "(", "o1", ",", "o2", "*", "AdvancedOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// AdvancedEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "AdvancedEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/advanced.go#L55-L63
train
algolia/algoliasearch-client-go
algolia/internal/opt/click_analytics.go
ExtractClickAnalytics
func ExtractClickAnalytics(opts ...interface{}) *opt.ClickAnalyticsOption { for _, o := range opts { if v, ok := o.(*opt.ClickAnalyticsOption); ok { return v } } return nil }
go
func ExtractClickAnalytics(opts ...interface{}) *opt.ClickAnalyticsOption { for _, o := range opts { if v, ok := o.(*opt.ClickAnalyticsOption); ok { return v } } return nil }
[ "func", "ExtractClickAnalytics", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "ClickAnalyticsOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "ClickAnalyticsOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractClickAnalytics returns the first found ClickAnalyticsOption from the // given variadic arguments or nil otherwise.
[ "ExtractClickAnalytics", "returns", "the", "first", "found", "ClickAnalyticsOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/click_analytics.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/unretrievable_attributes.go
ExtractUnretrievableAttributes
func ExtractUnretrievableAttributes(opts ...interface{}) *opt.UnretrievableAttributesOption { for _, o := range opts { if v, ok := o.(*opt.UnretrievableAttributesOption); ok { return v } } return nil }
go
func ExtractUnretrievableAttributes(opts ...interface{}) *opt.UnretrievableAttributesOption { for _, o := range opts { if v, ok := o.(*opt.UnretrievableAttributesOption); ok { return v } } return nil }
[ "func", "ExtractUnretrievableAttributes", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "UnretrievableAttributesOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "UnretrievableAttributesOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractUnretrievableAttributes returns the first found UnretrievableAttributesOption from the // given variadic arguments or nil otherwise.
[ "ExtractUnretrievableAttributes", "returns", "the", "first", "found", "UnretrievableAttributesOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/unretrievable_attributes.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/searchable_attributes.go
ExtractSearchableAttributes
func ExtractSearchableAttributes(opts ...interface{}) *opt.SearchableAttributesOption { for _, o := range opts { if v, ok := o.(*opt.SearchableAttributesOption); ok { return v } } return nil }
go
func ExtractSearchableAttributes(opts ...interface{}) *opt.SearchableAttributesOption { for _, o := range opts { if v, ok := o.(*opt.SearchableAttributesOption); ok { return v } } return nil }
[ "func", "ExtractSearchableAttributes", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "SearchableAttributesOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "SearchableAttributesOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractSearchableAttributes returns the first found SearchableAttributesOption from the // given variadic arguments or nil otherwise.
[ "ExtractSearchableAttributes", "returns", "the", "first", "found", "SearchableAttributesOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/searchable_attributes.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/advanced.go
ExtractAdvanced
func ExtractAdvanced(opts ...interface{}) *opt.AdvancedOption { for _, o := range opts { if v, ok := o.(*opt.AdvancedOption); ok { return v } } return nil }
go
func ExtractAdvanced(opts ...interface{}) *opt.AdvancedOption { for _, o := range opts { if v, ok := o.(*opt.AdvancedOption); ok { return v } } return nil }
[ "func", "ExtractAdvanced", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "AdvancedOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "AdvancedOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractAdvanced returns the first found AdvancedOption from the // given variadic arguments or nil otherwise.
[ "ExtractAdvanced", "returns", "the", "first", "found", "AdvancedOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/advanced.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/internal/opt/get_ranking_info.go
ExtractGetRankingInfo
func ExtractGetRankingInfo(opts ...interface{}) *opt.GetRankingInfoOption { for _, o := range opts { if v, ok := o.(*opt.GetRankingInfoOption); ok { return v } } return nil }
go
func ExtractGetRankingInfo(opts ...interface{}) *opt.GetRankingInfoOption { for _, o := range opts { if v, ok := o.(*opt.GetRankingInfoOption); ok { return v } } return nil }
[ "func", "ExtractGetRankingInfo", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "GetRankingInfoOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "GetRankingInfoOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractGetRankingInfo returns the first found GetRankingInfoOption from the // given variadic arguments or nil otherwise.
[ "ExtractGetRankingInfo", "returns", "the", "first", "found", "GetRankingInfoOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/get_ranking_info.go#L11-L18
train
algolia/algoliasearch-client-go
algolia/opt/explain.go
ExplainEqual
func ExplainEqual(o1, o2 *ExplainOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func ExplainEqual(o1, o2 *ExplainOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "ExplainEqual", "(", "o1", ",", "o2", "*", "ExplainOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// ExplainEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "ExplainEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/explain.go#L58-L66
train
algolia/algoliasearch-client-go
algolia/opt/valid_until.go
UnmarshalJSON
func (o *ValidUntilOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { o.value = time.Time{} return nil } return json.Unmarshal(data, &o.value) }
go
func (o *ValidUntilOption) UnmarshalJSON(data []byte) error { if string(data) == "null" { o.value = time.Time{} return nil } return json.Unmarshal(data, &o.value) }
[ "func", "(", "o", "*", "ValidUntilOption", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "if", "string", "(", "data", ")", "==", "\"", "\"", "{", "o", ".", "value", "=", "time", ".", "Time", "{", "}", "\n", "return", "nil", "\n", "}", "\n", "return", "json", ".", "Unmarshal", "(", "data", ",", "&", "o", ".", "value", ")", "\n", "}" ]
// UnmarshalJSON implements the json.Unmarshaler interface for // ValidUntilOption.
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "for", "ValidUntilOption", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/valid_until.go#L35-L41
train
algolia/algoliasearch-client-go
algolia/opt/valid_until.go
ValidUntilEqual
func ValidUntilEqual(o1, o2 *ValidUntilOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
go
func ValidUntilEqual(o1, o2 *ValidUntilOption) bool { if o1 != nil { return o1.Equal(o2) } if o2 != nil { return o2.Equal(o1) } return true }
[ "func", "ValidUntilEqual", "(", "o1", ",", "o2", "*", "ValidUntilOption", ")", "bool", "{", "if", "o1", "!=", "nil", "{", "return", "o1", ".", "Equal", "(", "o2", ")", "\n", "}", "\n", "if", "o2", "!=", "nil", "{", "return", "o2", ".", "Equal", "(", "o1", ")", "\n", "}", "\n", "return", "true", "\n", "}" ]
// ValidUntilEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "ValidUntilEqual", "returns", "true", "if", "the", "two", "options", "are", "equal", ".", "In", "case", "of", "one", "option", "being", "nil", "the", "value", "of", "the", "other", "must", "be", "nil", "as", "well", "or", "be", "set", "to", "the", "default", "value", "of", "this", "option", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/valid_until.go#L56-L64
train
algolia/algoliasearch-client-go
algolia/debug/debug.go
Display
func Display(itf interface{}) { if !debug { return } switch v := itf.(type) { case *http.Request: printRequest(v) case *http.Response: printResponse(v) default: fmt.Printf("do not know how to debug-print %#v\n", v) } }
go
func Display(itf interface{}) { if !debug { return } switch v := itf.(type) { case *http.Request: printRequest(v) case *http.Response: printResponse(v) default: fmt.Printf("do not know how to debug-print %#v\n", v) } }
[ "func", "Display", "(", "itf", "interface", "{", "}", ")", "{", "if", "!", "debug", "{", "return", "\n", "}", "\n", "switch", "v", ":=", "itf", ".", "(", "type", ")", "{", "case", "*", "http", ".", "Request", ":", "printRequest", "(", "v", ")", "\n", "case", "*", "http", ".", "Response", ":", "printResponse", "(", "v", ")", "\n", "default", ":", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "v", ")", "\n", "}", "\n", "}" ]
// Display displays the given parameter on the standard output in a custom way, // depending on the given input type. This function is internally used by the // Algolia API client to display, for instance, HTTP requests and responses when // debug logging is enabled.
[ "Display", "displays", "the", "given", "parameter", "on", "the", "standard", "output", "in", "a", "custom", "way", "depending", "on", "the", "given", "input", "type", ".", "This", "function", "is", "internally", "used", "by", "the", "Algolia", "API", "client", "to", "display", "for", "instance", "HTTP", "requests", "and", "responses", "when", "debug", "logging", "is", "enabled", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/debug/debug.go#L33-L45
train
algolia/algoliasearch-client-go
algolia/internal/opt/offset.go
ExtractOffset
func ExtractOffset(opts ...interface{}) *opt.OffsetOption { for _, o := range opts { if v, ok := o.(*opt.OffsetOption); ok { return v } } return nil }
go
func ExtractOffset(opts ...interface{}) *opt.OffsetOption { for _, o := range opts { if v, ok := o.(*opt.OffsetOption); ok { return v } } return nil }
[ "func", "ExtractOffset", "(", "opts", "...", "interface", "{", "}", ")", "*", "opt", ".", "OffsetOption", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "v", ",", "ok", ":=", "o", ".", "(", "*", "opt", ".", "OffsetOption", ")", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// ExtractOffset returns the first found OffsetOption from the // given variadic arguments or nil otherwise.
[ "ExtractOffset", "returns", "the", "first", "found", "OffsetOption", "from", "the", "given", "variadic", "arguments", "or", "nil", "otherwise", "." ]
dc059c0414d8c06e2b2bb47412b2130799bfcc9f
https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/offset.go#L11-L18
train
grpc-ecosystem/go-grpc-prometheus
client_metrics.go
NewClientMetrics
func NewClientMetrics(counterOpts ...CounterOption) *ClientMetrics { opts := counterOptions(counterOpts) return &ClientMetrics{ clientStartedCounter: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_client_started_total", Help: "Total number of RPCs started on the client.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), clientHandledCounter: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_client_handled_total", Help: "Total number of RPCs completed by the client, regardless of success or failure.", }), []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code"}), clientStreamMsgReceived: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_client_msg_received_total", Help: "Total number of RPC stream messages received by the client.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), clientStreamMsgSent: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_client_msg_sent_total", Help: "Total number of gRPC stream messages sent by the client.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), clientHandledHistogramEnabled: false, clientHandledHistogramOpts: prom.HistogramOpts{ Name: "grpc_client_handling_seconds", Help: "Histogram of response latency (seconds) of the gRPC until it is finished by the application.", Buckets: prom.DefBuckets, }, clientHandledHistogram: nil, clientStreamRecvHistogramEnabled: false, clientStreamRecvHistogramOpts: prom.HistogramOpts{ Name: "grpc_client_msg_recv_handling_seconds", Help: "Histogram of response latency (seconds) of the gRPC single message receive.", Buckets: prom.DefBuckets, }, clientStreamRecvHistogram: nil, clientStreamSendHistogramEnabled: false, clientStreamSendHistogramOpts: prom.HistogramOpts{ Name: "grpc_client_msg_send_handling_seconds", Help: "Histogram of response latency (seconds) of the gRPC single message send.", Buckets: prom.DefBuckets, }, clientStreamSendHistogram: nil, } }
go
func NewClientMetrics(counterOpts ...CounterOption) *ClientMetrics { opts := counterOptions(counterOpts) return &ClientMetrics{ clientStartedCounter: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_client_started_total", Help: "Total number of RPCs started on the client.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), clientHandledCounter: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_client_handled_total", Help: "Total number of RPCs completed by the client, regardless of success or failure.", }), []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code"}), clientStreamMsgReceived: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_client_msg_received_total", Help: "Total number of RPC stream messages received by the client.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), clientStreamMsgSent: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_client_msg_sent_total", Help: "Total number of gRPC stream messages sent by the client.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), clientHandledHistogramEnabled: false, clientHandledHistogramOpts: prom.HistogramOpts{ Name: "grpc_client_handling_seconds", Help: "Histogram of response latency (seconds) of the gRPC until it is finished by the application.", Buckets: prom.DefBuckets, }, clientHandledHistogram: nil, clientStreamRecvHistogramEnabled: false, clientStreamRecvHistogramOpts: prom.HistogramOpts{ Name: "grpc_client_msg_recv_handling_seconds", Help: "Histogram of response latency (seconds) of the gRPC single message receive.", Buckets: prom.DefBuckets, }, clientStreamRecvHistogram: nil, clientStreamSendHistogramEnabled: false, clientStreamSendHistogramOpts: prom.HistogramOpts{ Name: "grpc_client_msg_send_handling_seconds", Help: "Histogram of response latency (seconds) of the gRPC single message send.", Buckets: prom.DefBuckets, }, clientStreamSendHistogram: nil, } }
[ "func", "NewClientMetrics", "(", "counterOpts", "...", "CounterOption", ")", "*", "ClientMetrics", "{", "opts", ":=", "counterOptions", "(", "counterOpts", ")", "\n", "return", "&", "ClientMetrics", "{", "clientStartedCounter", ":", "prom", ".", "NewCounterVec", "(", "opts", ".", "apply", "(", "prom", ".", "CounterOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "}", ")", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", ",", "clientHandledCounter", ":", "prom", ".", "NewCounterVec", "(", "opts", ".", "apply", "(", "prom", ".", "CounterOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "}", ")", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", ",", "clientStreamMsgReceived", ":", "prom", ".", "NewCounterVec", "(", "opts", ".", "apply", "(", "prom", ".", "CounterOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "}", ")", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", ",", "clientStreamMsgSent", ":", "prom", ".", "NewCounterVec", "(", "opts", ".", "apply", "(", "prom", ".", "CounterOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "}", ")", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", ",", "clientHandledHistogramEnabled", ":", "false", ",", "clientHandledHistogramOpts", ":", "prom", ".", "HistogramOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "Buckets", ":", "prom", ".", "DefBuckets", ",", "}", ",", "clientHandledHistogram", ":", "nil", ",", "clientStreamRecvHistogramEnabled", ":", "false", ",", "clientStreamRecvHistogramOpts", ":", "prom", ".", "HistogramOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "Buckets", ":", "prom", ".", "DefBuckets", ",", "}", ",", "clientStreamRecvHistogram", ":", "nil", ",", "clientStreamSendHistogramEnabled", ":", "false", ",", "clientStreamSendHistogramOpts", ":", "prom", ".", "HistogramOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "Buckets", ":", "prom", ".", "DefBuckets", ",", "}", ",", "clientStreamSendHistogram", ":", "nil", ",", "}", "\n", "}" ]
// NewClientMetrics returns a ClientMetrics object. Use a new instance of // ClientMetrics when not using the default Prometheus metrics registry, for // example when wanting to control which metrics are added to a registry as // opposed to automatically adding metrics via init functions.
[ "NewClientMetrics", "returns", "a", "ClientMetrics", "object", ".", "Use", "a", "new", "instance", "of", "ClientMetrics", "when", "not", "using", "the", "default", "Prometheus", "metrics", "registry", "for", "example", "when", "wanting", "to", "control", "which", "metrics", "are", "added", "to", "a", "registry", "as", "opposed", "to", "automatically", "adding", "metrics", "via", "init", "functions", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client_metrics.go#L38-L87
train
grpc-ecosystem/go-grpc-prometheus
client_metrics.go
EnableClientHandlingTimeHistogram
func (m *ClientMetrics) EnableClientHandlingTimeHistogram(opts ...HistogramOption) { for _, o := range opts { o(&m.clientHandledHistogramOpts) } if !m.clientHandledHistogramEnabled { m.clientHandledHistogram = prom.NewHistogramVec( m.clientHandledHistogramOpts, []string{"grpc_type", "grpc_service", "grpc_method"}, ) } m.clientHandledHistogramEnabled = true }
go
func (m *ClientMetrics) EnableClientHandlingTimeHistogram(opts ...HistogramOption) { for _, o := range opts { o(&m.clientHandledHistogramOpts) } if !m.clientHandledHistogramEnabled { m.clientHandledHistogram = prom.NewHistogramVec( m.clientHandledHistogramOpts, []string{"grpc_type", "grpc_service", "grpc_method"}, ) } m.clientHandledHistogramEnabled = true }
[ "func", "(", "m", "*", "ClientMetrics", ")", "EnableClientHandlingTimeHistogram", "(", "opts", "...", "HistogramOption", ")", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "o", "(", "&", "m", ".", "clientHandledHistogramOpts", ")", "\n", "}", "\n", "if", "!", "m", ".", "clientHandledHistogramEnabled", "{", "m", ".", "clientHandledHistogram", "=", "prom", ".", "NewHistogramVec", "(", "m", ".", "clientHandledHistogramOpts", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", ")", "\n", "}", "\n", "m", ".", "clientHandledHistogramEnabled", "=", "true", "\n", "}" ]
// EnableClientHandlingTimeHistogram turns on recording of handling time of RPCs. // Histogram metrics can be very expensive for Prometheus to retain and query.
[ "EnableClientHandlingTimeHistogram", "turns", "on", "recording", "of", "handling", "time", "of", "RPCs", ".", "Histogram", "metrics", "can", "be", "very", "expensive", "for", "Prometheus", "to", "retain", "and", "query", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client_metrics.go#L129-L140
train
grpc-ecosystem/go-grpc-prometheus
client_metrics.go
EnableClientStreamReceiveTimeHistogram
func (m *ClientMetrics) EnableClientStreamReceiveTimeHistogram(opts ...HistogramOption) { for _, o := range opts { o(&m.clientStreamRecvHistogramOpts) } if !m.clientStreamRecvHistogramEnabled { m.clientStreamRecvHistogram = prom.NewHistogramVec( m.clientStreamRecvHistogramOpts, []string{"grpc_type", "grpc_service", "grpc_method"}, ) } m.clientStreamRecvHistogramEnabled = true }
go
func (m *ClientMetrics) EnableClientStreamReceiveTimeHistogram(opts ...HistogramOption) { for _, o := range opts { o(&m.clientStreamRecvHistogramOpts) } if !m.clientStreamRecvHistogramEnabled { m.clientStreamRecvHistogram = prom.NewHistogramVec( m.clientStreamRecvHistogramOpts, []string{"grpc_type", "grpc_service", "grpc_method"}, ) } m.clientStreamRecvHistogramEnabled = true }
[ "func", "(", "m", "*", "ClientMetrics", ")", "EnableClientStreamReceiveTimeHistogram", "(", "opts", "...", "HistogramOption", ")", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "o", "(", "&", "m", ".", "clientStreamRecvHistogramOpts", ")", "\n", "}", "\n\n", "if", "!", "m", ".", "clientStreamRecvHistogramEnabled", "{", "m", ".", "clientStreamRecvHistogram", "=", "prom", ".", "NewHistogramVec", "(", "m", ".", "clientStreamRecvHistogramOpts", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", ")", "\n", "}", "\n\n", "m", ".", "clientStreamRecvHistogramEnabled", "=", "true", "\n", "}" ]
// EnableClientStreamReceiveTimeHistogram turns on recording of single message receive time of streaming RPCs. // Histogram metrics can be very expensive for Prometheus to retain and query.
[ "EnableClientStreamReceiveTimeHistogram", "turns", "on", "recording", "of", "single", "message", "receive", "time", "of", "streaming", "RPCs", ".", "Histogram", "metrics", "can", "be", "very", "expensive", "for", "Prometheus", "to", "retain", "and", "query", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client_metrics.go#L144-L157
train
grpc-ecosystem/go-grpc-prometheus
client_metrics.go
EnableClientStreamSendTimeHistogram
func (m *ClientMetrics) EnableClientStreamSendTimeHistogram(opts ...HistogramOption) { for _, o := range opts { o(&m.clientStreamSendHistogramOpts) } if !m.clientStreamSendHistogramEnabled { m.clientStreamSendHistogram = prom.NewHistogramVec( m.clientStreamSendHistogramOpts, []string{"grpc_type", "grpc_service", "grpc_method"}, ) } m.clientStreamSendHistogramEnabled = true }
go
func (m *ClientMetrics) EnableClientStreamSendTimeHistogram(opts ...HistogramOption) { for _, o := range opts { o(&m.clientStreamSendHistogramOpts) } if !m.clientStreamSendHistogramEnabled { m.clientStreamSendHistogram = prom.NewHistogramVec( m.clientStreamSendHistogramOpts, []string{"grpc_type", "grpc_service", "grpc_method"}, ) } m.clientStreamSendHistogramEnabled = true }
[ "func", "(", "m", "*", "ClientMetrics", ")", "EnableClientStreamSendTimeHistogram", "(", "opts", "...", "HistogramOption", ")", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "o", "(", "&", "m", ".", "clientStreamSendHistogramOpts", ")", "\n", "}", "\n\n", "if", "!", "m", ".", "clientStreamSendHistogramEnabled", "{", "m", ".", "clientStreamSendHistogram", "=", "prom", ".", "NewHistogramVec", "(", "m", ".", "clientStreamSendHistogramOpts", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", ")", "\n", "}", "\n\n", "m", ".", "clientStreamSendHistogramEnabled", "=", "true", "\n", "}" ]
// EnableClientStreamSendTimeHistogram turns on recording of single message send time of streaming RPCs. // Histogram metrics can be very expensive for Prometheus to retain and query.
[ "EnableClientStreamSendTimeHistogram", "turns", "on", "recording", "of", "single", "message", "send", "time", "of", "streaming", "RPCs", ".", "Histogram", "metrics", "can", "be", "very", "expensive", "for", "Prometheus", "to", "retain", "and", "query", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client_metrics.go#L161-L174
train
grpc-ecosystem/go-grpc-prometheus
client_metrics.go
UnaryClientInterceptor
func (m *ClientMetrics) UnaryClientInterceptor() func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { monitor := newClientReporter(m, Unary, method) monitor.SentMessage() err := invoker(ctx, method, req, reply, cc, opts...) if err != nil { monitor.ReceivedMessage() } st, _ := status.FromError(err) monitor.Handled(st.Code()) return err } }
go
func (m *ClientMetrics) UnaryClientInterceptor() func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { monitor := newClientReporter(m, Unary, method) monitor.SentMessage() err := invoker(ctx, method, req, reply, cc, opts...) if err != nil { monitor.ReceivedMessage() } st, _ := status.FromError(err) monitor.Handled(st.Code()) return err } }
[ "func", "(", "m", "*", "ClientMetrics", ")", "UnaryClientInterceptor", "(", ")", "func", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "req", ",", "reply", "interface", "{", "}", ",", "cc", "*", "grpc", ".", "ClientConn", ",", "invoker", "grpc", ".", "UnaryInvoker", ",", "opts", "...", "grpc", ".", "CallOption", ")", "error", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "req", ",", "reply", "interface", "{", "}", ",", "cc", "*", "grpc", ".", "ClientConn", ",", "invoker", "grpc", ".", "UnaryInvoker", ",", "opts", "...", "grpc", ".", "CallOption", ")", "error", "{", "monitor", ":=", "newClientReporter", "(", "m", ",", "Unary", ",", "method", ")", "\n", "monitor", ".", "SentMessage", "(", ")", "\n", "err", ":=", "invoker", "(", "ctx", ",", "method", ",", "req", ",", "reply", ",", "cc", ",", "opts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "monitor", ".", "ReceivedMessage", "(", ")", "\n", "}", "\n", "st", ",", "_", ":=", "status", ".", "FromError", "(", "err", ")", "\n", "monitor", ".", "Handled", "(", "st", ".", "Code", "(", ")", ")", "\n", "return", "err", "\n", "}", "\n", "}" ]
// UnaryClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Unary RPCs.
[ "UnaryClientInterceptor", "is", "a", "gRPC", "client", "-", "side", "interceptor", "that", "provides", "Prometheus", "monitoring", "for", "Unary", "RPCs", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client_metrics.go#L177-L189
train
grpc-ecosystem/go-grpc-prometheus
client_metrics.go
StreamClientInterceptor
func (m *ClientMetrics) StreamClientInterceptor() func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { monitor := newClientReporter(m, clientStreamType(desc), method) clientStream, err := streamer(ctx, desc, cc, method, opts...) if err != nil { st, _ := status.FromError(err) monitor.Handled(st.Code()) return nil, err } return &monitoredClientStream{clientStream, monitor}, nil } }
go
func (m *ClientMetrics) StreamClientInterceptor() func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { monitor := newClientReporter(m, clientStreamType(desc), method) clientStream, err := streamer(ctx, desc, cc, method, opts...) if err != nil { st, _ := status.FromError(err) monitor.Handled(st.Code()) return nil, err } return &monitoredClientStream{clientStream, monitor}, nil } }
[ "func", "(", "m", "*", "ClientMetrics", ")", "StreamClientInterceptor", "(", ")", "func", "(", "ctx", "context", ".", "Context", ",", "desc", "*", "grpc", ".", "StreamDesc", ",", "cc", "*", "grpc", ".", "ClientConn", ",", "method", "string", ",", "streamer", "grpc", ".", "Streamer", ",", "opts", "...", "grpc", ".", "CallOption", ")", "(", "grpc", ".", "ClientStream", ",", "error", ")", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "desc", "*", "grpc", ".", "StreamDesc", ",", "cc", "*", "grpc", ".", "ClientConn", ",", "method", "string", ",", "streamer", "grpc", ".", "Streamer", ",", "opts", "...", "grpc", ".", "CallOption", ")", "(", "grpc", ".", "ClientStream", ",", "error", ")", "{", "monitor", ":=", "newClientReporter", "(", "m", ",", "clientStreamType", "(", "desc", ")", ",", "method", ")", "\n", "clientStream", ",", "err", ":=", "streamer", "(", "ctx", ",", "desc", ",", "cc", ",", "method", ",", "opts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "st", ",", "_", ":=", "status", ".", "FromError", "(", "err", ")", "\n", "monitor", ".", "Handled", "(", "st", ".", "Code", "(", ")", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "monitoredClientStream", "{", "clientStream", ",", "monitor", "}", ",", "nil", "\n", "}", "\n", "}" ]
// StreamClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Streaming RPCs.
[ "StreamClientInterceptor", "is", "a", "gRPC", "client", "-", "side", "interceptor", "that", "provides", "Prometheus", "monitoring", "for", "Streaming", "RPCs", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client_metrics.go#L192-L203
train
grpc-ecosystem/go-grpc-prometheus
examples/grpc-server-with-prometheus/server/server.go
SayHello
func (s *DemoServiceServer) SayHello(ctx context.Context, request *pb.HelloRequest) (*pb.HelloResponse, error) { customizedCounterMetric.WithLabelValues(request.Name).Inc() return &pb.HelloResponse{Message: fmt.Sprintf("Hello %s", request.Name)}, nil }
go
func (s *DemoServiceServer) SayHello(ctx context.Context, request *pb.HelloRequest) (*pb.HelloResponse, error) { customizedCounterMetric.WithLabelValues(request.Name).Inc() return &pb.HelloResponse{Message: fmt.Sprintf("Hello %s", request.Name)}, nil }
[ "func", "(", "s", "*", "DemoServiceServer", ")", "SayHello", "(", "ctx", "context", ".", "Context", ",", "request", "*", "pb", ".", "HelloRequest", ")", "(", "*", "pb", ".", "HelloResponse", ",", "error", ")", "{", "customizedCounterMetric", ".", "WithLabelValues", "(", "request", ".", "Name", ")", ".", "Inc", "(", ")", "\n", "return", "&", "pb", ".", "HelloResponse", "{", "Message", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "request", ".", "Name", ")", "}", ",", "nil", "\n", "}" ]
// SayHello implements a interface defined by protobuf.
[ "SayHello", "implements", "a", "interface", "defined", "by", "protobuf", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/examples/grpc-server-with-prometheus/server/server.go#L26-L29
train
grpc-ecosystem/go-grpc-prometheus
server.go
EnableHandlingTimeHistogram
func EnableHandlingTimeHistogram(opts ...HistogramOption) { DefaultServerMetrics.EnableHandlingTimeHistogram(opts...) prom.Register(DefaultServerMetrics.serverHandledHistogram) }
go
func EnableHandlingTimeHistogram(opts ...HistogramOption) { DefaultServerMetrics.EnableHandlingTimeHistogram(opts...) prom.Register(DefaultServerMetrics.serverHandledHistogram) }
[ "func", "EnableHandlingTimeHistogram", "(", "opts", "...", "HistogramOption", ")", "{", "DefaultServerMetrics", ".", "EnableHandlingTimeHistogram", "(", "opts", "...", ")", "\n", "prom", ".", "Register", "(", "DefaultServerMetrics", ".", "serverHandledHistogram", ")", "\n", "}" ]
// EnableHandlingTimeHistogram turns on recording of handling time // of RPCs. Histogram metrics can be very expensive for Prometheus // to retain and query. This function acts on the DefaultServerMetrics // variable and the default Prometheus metrics registry.
[ "EnableHandlingTimeHistogram", "turns", "on", "recording", "of", "handling", "time", "of", "RPCs", ".", "Histogram", "metrics", "can", "be", "very", "expensive", "for", "Prometheus", "to", "retain", "and", "query", ".", "This", "function", "acts", "on", "the", "DefaultServerMetrics", "variable", "and", "the", "default", "Prometheus", "metrics", "registry", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/server.go#L45-L48
train
grpc-ecosystem/go-grpc-prometheus
server_metrics.go
NewServerMetrics
func NewServerMetrics(counterOpts ...CounterOption) *ServerMetrics { opts := counterOptions(counterOpts) return &ServerMetrics{ serverStartedCounter: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_server_started_total", Help: "Total number of RPCs started on the server.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), serverHandledCounter: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_server_handled_total", Help: "Total number of RPCs completed on the server, regardless of success or failure.", }), []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code"}), serverStreamMsgReceived: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_server_msg_received_total", Help: "Total number of RPC stream messages received on the server.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), serverStreamMsgSent: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_server_msg_sent_total", Help: "Total number of gRPC stream messages sent by the server.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), serverHandledHistogramEnabled: false, serverHandledHistogramOpts: prom.HistogramOpts{ Name: "grpc_server_handling_seconds", Help: "Histogram of response latency (seconds) of gRPC that had been application-level handled by the server.", Buckets: prom.DefBuckets, }, serverHandledHistogram: nil, } }
go
func NewServerMetrics(counterOpts ...CounterOption) *ServerMetrics { opts := counterOptions(counterOpts) return &ServerMetrics{ serverStartedCounter: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_server_started_total", Help: "Total number of RPCs started on the server.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), serverHandledCounter: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_server_handled_total", Help: "Total number of RPCs completed on the server, regardless of success or failure.", }), []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code"}), serverStreamMsgReceived: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_server_msg_received_total", Help: "Total number of RPC stream messages received on the server.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), serverStreamMsgSent: prom.NewCounterVec( opts.apply(prom.CounterOpts{ Name: "grpc_server_msg_sent_total", Help: "Total number of gRPC stream messages sent by the server.", }), []string{"grpc_type", "grpc_service", "grpc_method"}), serverHandledHistogramEnabled: false, serverHandledHistogramOpts: prom.HistogramOpts{ Name: "grpc_server_handling_seconds", Help: "Histogram of response latency (seconds) of gRPC that had been application-level handled by the server.", Buckets: prom.DefBuckets, }, serverHandledHistogram: nil, } }
[ "func", "NewServerMetrics", "(", "counterOpts", "...", "CounterOption", ")", "*", "ServerMetrics", "{", "opts", ":=", "counterOptions", "(", "counterOpts", ")", "\n", "return", "&", "ServerMetrics", "{", "serverStartedCounter", ":", "prom", ".", "NewCounterVec", "(", "opts", ".", "apply", "(", "prom", ".", "CounterOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "}", ")", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", ",", "serverHandledCounter", ":", "prom", ".", "NewCounterVec", "(", "opts", ".", "apply", "(", "prom", ".", "CounterOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "}", ")", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", ",", "serverStreamMsgReceived", ":", "prom", ".", "NewCounterVec", "(", "opts", ".", "apply", "(", "prom", ".", "CounterOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "}", ")", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", ",", "serverStreamMsgSent", ":", "prom", ".", "NewCounterVec", "(", "opts", ".", "apply", "(", "prom", ".", "CounterOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "}", ")", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", ",", "serverHandledHistogramEnabled", ":", "false", ",", "serverHandledHistogramOpts", ":", "prom", ".", "HistogramOpts", "{", "Name", ":", "\"", "\"", ",", "Help", ":", "\"", "\"", ",", "Buckets", ":", "prom", ".", "DefBuckets", ",", "}", ",", "serverHandledHistogram", ":", "nil", ",", "}", "\n", "}" ]
// NewServerMetrics returns a ServerMetrics object. Use a new instance of // ServerMetrics when not using the default Prometheus metrics registry, for // example when wanting to control which metrics are added to a registry as // opposed to automatically adding metrics via init functions.
[ "NewServerMetrics", "returns", "a", "ServerMetrics", "object", ".", "Use", "a", "new", "instance", "of", "ServerMetrics", "when", "not", "using", "the", "default", "Prometheus", "metrics", "registry", "for", "example", "when", "wanting", "to", "control", "which", "metrics", "are", "added", "to", "a", "registry", "as", "opposed", "to", "automatically", "adding", "metrics", "via", "init", "functions", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/server_metrics.go#L27-L58
train
grpc-ecosystem/go-grpc-prometheus
server_metrics.go
EnableHandlingTimeHistogram
func (m *ServerMetrics) EnableHandlingTimeHistogram(opts ...HistogramOption) { for _, o := range opts { o(&m.serverHandledHistogramOpts) } if !m.serverHandledHistogramEnabled { m.serverHandledHistogram = prom.NewHistogramVec( m.serverHandledHistogramOpts, []string{"grpc_type", "grpc_service", "grpc_method"}, ) } m.serverHandledHistogramEnabled = true }
go
func (m *ServerMetrics) EnableHandlingTimeHistogram(opts ...HistogramOption) { for _, o := range opts { o(&m.serverHandledHistogramOpts) } if !m.serverHandledHistogramEnabled { m.serverHandledHistogram = prom.NewHistogramVec( m.serverHandledHistogramOpts, []string{"grpc_type", "grpc_service", "grpc_method"}, ) } m.serverHandledHistogramEnabled = true }
[ "func", "(", "m", "*", "ServerMetrics", ")", "EnableHandlingTimeHistogram", "(", "opts", "...", "HistogramOption", ")", "{", "for", "_", ",", "o", ":=", "range", "opts", "{", "o", "(", "&", "m", ".", "serverHandledHistogramOpts", ")", "\n", "}", "\n", "if", "!", "m", ".", "serverHandledHistogramEnabled", "{", "m", ".", "serverHandledHistogram", "=", "prom", ".", "NewHistogramVec", "(", "m", ".", "serverHandledHistogramOpts", ",", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", ")", "\n", "}", "\n", "m", ".", "serverHandledHistogramEnabled", "=", "true", "\n", "}" ]
// EnableHandlingTimeHistogram enables histograms being registered when // registering the ServerMetrics on a Prometheus registry. Histograms can be // expensive on Prometheus servers. It takes options to configure histogram // options such as the defined buckets.
[ "EnableHandlingTimeHistogram", "enables", "histograms", "being", "registered", "when", "registering", "the", "ServerMetrics", "on", "a", "Prometheus", "registry", ".", "Histograms", "can", "be", "expensive", "on", "Prometheus", "servers", ".", "It", "takes", "options", "to", "configure", "histogram", "options", "such", "as", "the", "defined", "buckets", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/server_metrics.go#L64-L75
train
grpc-ecosystem/go-grpc-prometheus
server_metrics.go
UnaryServerInterceptor
func (m *ServerMetrics) UnaryServerInterceptor() func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { monitor := newServerReporter(m, Unary, info.FullMethod) monitor.ReceivedMessage() resp, err := handler(ctx, req) st, _ := status.FromError(err) monitor.Handled(st.Code()) if err == nil { monitor.SentMessage() } return resp, err } }
go
func (m *ServerMetrics) UnaryServerInterceptor() func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { monitor := newServerReporter(m, Unary, info.FullMethod) monitor.ReceivedMessage() resp, err := handler(ctx, req) st, _ := status.FromError(err) monitor.Handled(st.Code()) if err == nil { monitor.SentMessage() } return resp, err } }
[ "func", "(", "m", "*", "ServerMetrics", ")", "UnaryServerInterceptor", "(", ")", "func", "(", "ctx", "context", ".", "Context", ",", "req", "interface", "{", "}", ",", "info", "*", "grpc", ".", "UnaryServerInfo", ",", "handler", "grpc", ".", "UnaryHandler", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "req", "interface", "{", "}", ",", "info", "*", "grpc", ".", "UnaryServerInfo", ",", "handler", "grpc", ".", "UnaryHandler", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "monitor", ":=", "newServerReporter", "(", "m", ",", "Unary", ",", "info", ".", "FullMethod", ")", "\n", "monitor", ".", "ReceivedMessage", "(", ")", "\n", "resp", ",", "err", ":=", "handler", "(", "ctx", ",", "req", ")", "\n", "st", ",", "_", ":=", "status", ".", "FromError", "(", "err", ")", "\n", "monitor", ".", "Handled", "(", "st", ".", "Code", "(", ")", ")", "\n", "if", "err", "==", "nil", "{", "monitor", ".", "SentMessage", "(", ")", "\n", "}", "\n", "return", "resp", ",", "err", "\n", "}", "\n", "}" ]
// UnaryServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Unary RPCs.
[ "UnaryServerInterceptor", "is", "a", "gRPC", "server", "-", "side", "interceptor", "that", "provides", "Prometheus", "monitoring", "for", "Unary", "RPCs", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/server_metrics.go#L104-L116
train
grpc-ecosystem/go-grpc-prometheus
server_metrics.go
StreamServerInterceptor
func (m *ServerMetrics) StreamServerInterceptor() func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { monitor := newServerReporter(m, streamRPCType(info), info.FullMethod) err := handler(srv, &monitoredServerStream{ss, monitor}) st, _ := status.FromError(err) monitor.Handled(st.Code()) return err } }
go
func (m *ServerMetrics) StreamServerInterceptor() func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { monitor := newServerReporter(m, streamRPCType(info), info.FullMethod) err := handler(srv, &monitoredServerStream{ss, monitor}) st, _ := status.FromError(err) monitor.Handled(st.Code()) return err } }
[ "func", "(", "m", "*", "ServerMetrics", ")", "StreamServerInterceptor", "(", ")", "func", "(", "srv", "interface", "{", "}", ",", "ss", "grpc", ".", "ServerStream", ",", "info", "*", "grpc", ".", "StreamServerInfo", ",", "handler", "grpc", ".", "StreamHandler", ")", "error", "{", "return", "func", "(", "srv", "interface", "{", "}", ",", "ss", "grpc", ".", "ServerStream", ",", "info", "*", "grpc", ".", "StreamServerInfo", ",", "handler", "grpc", ".", "StreamHandler", ")", "error", "{", "monitor", ":=", "newServerReporter", "(", "m", ",", "streamRPCType", "(", "info", ")", ",", "info", ".", "FullMethod", ")", "\n", "err", ":=", "handler", "(", "srv", ",", "&", "monitoredServerStream", "{", "ss", ",", "monitor", "}", ")", "\n", "st", ",", "_", ":=", "status", ".", "FromError", "(", "err", ")", "\n", "monitor", ".", "Handled", "(", "st", ".", "Code", "(", ")", ")", "\n", "return", "err", "\n", "}", "\n", "}" ]
// StreamServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Streaming RPCs.
[ "StreamServerInterceptor", "is", "a", "gRPC", "server", "-", "side", "interceptor", "that", "provides", "Prometheus", "monitoring", "for", "Streaming", "RPCs", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/server_metrics.go#L119-L127
train
grpc-ecosystem/go-grpc-prometheus
server_metrics.go
InitializeMetrics
func (m *ServerMetrics) InitializeMetrics(server *grpc.Server) { serviceInfo := server.GetServiceInfo() for serviceName, info := range serviceInfo { for _, mInfo := range info.Methods { preRegisterMethod(m, serviceName, &mInfo) } } }
go
func (m *ServerMetrics) InitializeMetrics(server *grpc.Server) { serviceInfo := server.GetServiceInfo() for serviceName, info := range serviceInfo { for _, mInfo := range info.Methods { preRegisterMethod(m, serviceName, &mInfo) } } }
[ "func", "(", "m", "*", "ServerMetrics", ")", "InitializeMetrics", "(", "server", "*", "grpc", ".", "Server", ")", "{", "serviceInfo", ":=", "server", ".", "GetServiceInfo", "(", ")", "\n", "for", "serviceName", ",", "info", ":=", "range", "serviceInfo", "{", "for", "_", ",", "mInfo", ":=", "range", "info", ".", "Methods", "{", "preRegisterMethod", "(", "m", ",", "serviceName", ",", "&", "mInfo", ")", "\n", "}", "\n", "}", "\n", "}" ]
// InitializeMetrics initializes all metrics, with their appropriate null // value, for all gRPC methods registered on a gRPC server. This is useful, to // ensure that all metrics exist when collecting and querying.
[ "InitializeMetrics", "initializes", "all", "metrics", "with", "their", "appropriate", "null", "value", "for", "all", "gRPC", "methods", "registered", "on", "a", "gRPC", "server", ".", "This", "is", "useful", "to", "ensure", "that", "all", "metrics", "exist", "when", "collecting", "and", "querying", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/server_metrics.go#L132-L139
train
grpc-ecosystem/go-grpc-prometheus
server_metrics.go
preRegisterMethod
func preRegisterMethod(metrics *ServerMetrics, serviceName string, mInfo *grpc.MethodInfo) { methodName := mInfo.Name methodType := string(typeFromMethodInfo(mInfo)) // These are just references (no increments), as just referencing will create the labels but not set values. metrics.serverStartedCounter.GetMetricWithLabelValues(methodType, serviceName, methodName) metrics.serverStreamMsgReceived.GetMetricWithLabelValues(methodType, serviceName, methodName) metrics.serverStreamMsgSent.GetMetricWithLabelValues(methodType, serviceName, methodName) if metrics.serverHandledHistogramEnabled { metrics.serverHandledHistogram.GetMetricWithLabelValues(methodType, serviceName, methodName) } for _, code := range allCodes { metrics.serverHandledCounter.GetMetricWithLabelValues(methodType, serviceName, methodName, code.String()) } }
go
func preRegisterMethod(metrics *ServerMetrics, serviceName string, mInfo *grpc.MethodInfo) { methodName := mInfo.Name methodType := string(typeFromMethodInfo(mInfo)) // These are just references (no increments), as just referencing will create the labels but not set values. metrics.serverStartedCounter.GetMetricWithLabelValues(methodType, serviceName, methodName) metrics.serverStreamMsgReceived.GetMetricWithLabelValues(methodType, serviceName, methodName) metrics.serverStreamMsgSent.GetMetricWithLabelValues(methodType, serviceName, methodName) if metrics.serverHandledHistogramEnabled { metrics.serverHandledHistogram.GetMetricWithLabelValues(methodType, serviceName, methodName) } for _, code := range allCodes { metrics.serverHandledCounter.GetMetricWithLabelValues(methodType, serviceName, methodName, code.String()) } }
[ "func", "preRegisterMethod", "(", "metrics", "*", "ServerMetrics", ",", "serviceName", "string", ",", "mInfo", "*", "grpc", ".", "MethodInfo", ")", "{", "methodName", ":=", "mInfo", ".", "Name", "\n", "methodType", ":=", "string", "(", "typeFromMethodInfo", "(", "mInfo", ")", ")", "\n", "// These are just references (no increments), as just referencing will create the labels but not set values.", "metrics", ".", "serverStartedCounter", ".", "GetMetricWithLabelValues", "(", "methodType", ",", "serviceName", ",", "methodName", ")", "\n", "metrics", ".", "serverStreamMsgReceived", ".", "GetMetricWithLabelValues", "(", "methodType", ",", "serviceName", ",", "methodName", ")", "\n", "metrics", ".", "serverStreamMsgSent", ".", "GetMetricWithLabelValues", "(", "methodType", ",", "serviceName", ",", "methodName", ")", "\n", "if", "metrics", ".", "serverHandledHistogramEnabled", "{", "metrics", ".", "serverHandledHistogram", ".", "GetMetricWithLabelValues", "(", "methodType", ",", "serviceName", ",", "methodName", ")", "\n", "}", "\n", "for", "_", ",", "code", ":=", "range", "allCodes", "{", "metrics", ".", "serverHandledCounter", ".", "GetMetricWithLabelValues", "(", "methodType", ",", "serviceName", ",", "methodName", ",", "code", ".", "String", "(", ")", ")", "\n", "}", "\n", "}" ]
// preRegisterMethod is invoked on Register of a Server, allowing all gRPC services labels to be pre-populated.
[ "preRegisterMethod", "is", "invoked", "on", "Register", "of", "a", "Server", "allowing", "all", "gRPC", "services", "labels", "to", "be", "pre", "-", "populated", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/server_metrics.go#L173-L186
train
grpc-ecosystem/go-grpc-prometheus
client.go
EnableClientHandlingTimeHistogram
func EnableClientHandlingTimeHistogram(opts ...HistogramOption) { DefaultClientMetrics.EnableClientHandlingTimeHistogram(opts...) prom.Register(DefaultClientMetrics.clientHandledHistogram) }
go
func EnableClientHandlingTimeHistogram(opts ...HistogramOption) { DefaultClientMetrics.EnableClientHandlingTimeHistogram(opts...) prom.Register(DefaultClientMetrics.clientHandledHistogram) }
[ "func", "EnableClientHandlingTimeHistogram", "(", "opts", "...", "HistogramOption", ")", "{", "DefaultClientMetrics", ".", "EnableClientHandlingTimeHistogram", "(", "opts", "...", ")", "\n", "prom", ".", "Register", "(", "DefaultClientMetrics", ".", "clientHandledHistogram", ")", "\n", "}" ]
// EnableClientHandlingTimeHistogram turns on recording of handling time of // RPCs. Histogram metrics can be very expensive for Prometheus to retain and // query. This function acts on the DefaultClientMetrics variable and the // default Prometheus metrics registry.
[ "EnableClientHandlingTimeHistogram", "turns", "on", "recording", "of", "handling", "time", "of", "RPCs", ".", "Histogram", "metrics", "can", "be", "very", "expensive", "for", "Prometheus", "to", "retain", "and", "query", ".", "This", "function", "acts", "on", "the", "DefaultClientMetrics", "variable", "and", "the", "default", "Prometheus", "metrics", "registry", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client.go#L36-L39
train
grpc-ecosystem/go-grpc-prometheus
client.go
EnableClientStreamReceiveTimeHistogram
func EnableClientStreamReceiveTimeHistogram(opts ...HistogramOption) { DefaultClientMetrics.EnableClientStreamReceiveTimeHistogram(opts...) prom.Register(DefaultClientMetrics.clientStreamRecvHistogram) }
go
func EnableClientStreamReceiveTimeHistogram(opts ...HistogramOption) { DefaultClientMetrics.EnableClientStreamReceiveTimeHistogram(opts...) prom.Register(DefaultClientMetrics.clientStreamRecvHistogram) }
[ "func", "EnableClientStreamReceiveTimeHistogram", "(", "opts", "...", "HistogramOption", ")", "{", "DefaultClientMetrics", ".", "EnableClientStreamReceiveTimeHistogram", "(", "opts", "...", ")", "\n", "prom", ".", "Register", "(", "DefaultClientMetrics", ".", "clientStreamRecvHistogram", ")", "\n", "}" ]
// EnableClientStreamReceiveTimeHistogram turns on recording of // single message receive time of streaming RPCs. // This function acts on the DefaultClientMetrics variable and the // default Prometheus metrics registry.
[ "EnableClientStreamReceiveTimeHistogram", "turns", "on", "recording", "of", "single", "message", "receive", "time", "of", "streaming", "RPCs", ".", "This", "function", "acts", "on", "the", "DefaultClientMetrics", "variable", "and", "the", "default", "Prometheus", "metrics", "registry", "." ]
ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da
https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client.go#L45-L48
train