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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
libp2p/go-libp2p-kad-dht | opts/options.go | Client | func Client(only bool) Option {
return func(o *Options) error {
o.Client = only
return nil
}
} | go | func Client(only bool) Option {
return func(o *Options) error {
o.Client = only
return nil
}
} | [
"func",
"Client",
"(",
"only",
"bool",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"error",
"{",
"o",
".",
"Client",
"=",
"only",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // Client configures whether or not the DHT operates in client-only mode.
//
// Defaults to false. | [
"Client",
"configures",
"whether",
"or",
"not",
"the",
"DHT",
"operates",
"in",
"client",
"-",
"only",
"mode",
".",
"Defaults",
"to",
"false",
"."
] | fb62272e7ee5e16c07f88c30cb76e0f69e36ab69 | https://github.com/libp2p/go-libp2p-kad-dht/blob/fb62272e7ee5e16c07f88c30cb76e0f69e36ab69/opts/options.go#L66-L71 | train |
libp2p/go-libp2p-kad-dht | opts/options.go | Validator | func Validator(v record.Validator) Option {
return func(o *Options) error {
o.Validator = v
return nil
}
} | go | func Validator(v record.Validator) Option {
return func(o *Options) error {
o.Validator = v
return nil
}
} | [
"func",
"Validator",
"(",
"v",
"record",
".",
"Validator",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"error",
"{",
"o",
".",
"Validator",
"=",
"v",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // Validator configures the DHT to use the specified validator.
//
// Defaults to a namespaced validator that can only validate public keys. | [
"Validator",
"configures",
"the",
"DHT",
"to",
"use",
"the",
"specified",
"validator",
".",
"Defaults",
"to",
"a",
"namespaced",
"validator",
"that",
"can",
"only",
"validate",
"public",
"keys",
"."
] | fb62272e7ee5e16c07f88c30cb76e0f69e36ab69 | https://github.com/libp2p/go-libp2p-kad-dht/blob/fb62272e7ee5e16c07f88c30cb76e0f69e36ab69/opts/options.go#L76-L81 | train |
libp2p/go-libp2p-kad-dht | opts/options.go | Protocols | func Protocols(protocols ...protocol.ID) Option {
return func(o *Options) error {
o.Protocols = protocols
return nil
}
} | go | func Protocols(protocols ...protocol.ID) Option {
return func(o *Options) error {
o.Protocols = protocols
return nil
}
} | [
"func",
"Protocols",
"(",
"protocols",
"...",
"protocol",
".",
"ID",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"error",
"{",
"o",
".",
"Protocols",
"=",
"protocols",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // Protocols sets the protocols for the DHT
//
// Defaults to dht.DefaultProtocols | [
"Protocols",
"sets",
"the",
"protocols",
"for",
"the",
"DHT",
"Defaults",
"to",
"dht",
".",
"DefaultProtocols"
] | fb62272e7ee5e16c07f88c30cb76e0f69e36ab69 | https://github.com/libp2p/go-libp2p-kad-dht/blob/fb62272e7ee5e16c07f88c30cb76e0f69e36ab69/opts/options.go#L104-L109 | train |
libp2p/go-libp2p-kad-dht | metrics/metrics.go | UpsertMessageType | func UpsertMessageType(m *pb.Message) tag.Mutator {
return tag.Upsert(KeyMessageType, m.Type.String())
} | go | func UpsertMessageType(m *pb.Message) tag.Mutator {
return tag.Upsert(KeyMessageType, m.Type.String())
} | [
"func",
"UpsertMessageType",
"(",
"m",
"*",
"pb",
".",
"Message",
")",
"tag",
".",
"Mutator",
"{",
"return",
"tag",
".",
"Upsert",
"(",
"KeyMessageType",
",",
"m",
".",
"Type",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // UpsertMessageType is a convenience upserts the message type
// of a pb.Message into the KeyMessageType. | [
"UpsertMessageType",
"is",
"a",
"convenience",
"upserts",
"the",
"message",
"type",
"of",
"a",
"pb",
".",
"Message",
"into",
"the",
"KeyMessageType",
"."
] | fb62272e7ee5e16c07f88c30cb76e0f69e36ab69 | https://github.com/libp2p/go-libp2p-kad-dht/blob/fb62272e7ee5e16c07f88c30cb76e0f69e36ab69/metrics/metrics.go#L26-L28 | train |
libp2p/go-libp2p-kad-dht | pb/message.go | NewMessage | func NewMessage(typ Message_MessageType, key []byte, level int) *Message {
m := &Message{
Type: typ,
Key: key,
}
m.SetClusterLevel(level)
return m
} | go | func NewMessage(typ Message_MessageType, key []byte, level int) *Message {
m := &Message{
Type: typ,
Key: key,
}
m.SetClusterLevel(level)
return m
} | [
"func",
"NewMessage",
"(",
"typ",
"Message_MessageType",
",",
"key",
"[",
"]",
"byte",
",",
"level",
"int",
")",
"*",
"Message",
"{",
"m",
":=",
"&",
"Message",
"{",
"Type",
":",
"typ",
",",
"Key",
":",
"key",
",",
"}",
"\n",
"m",
".",
"SetClusterLevel",
"(",
"level",
")",
"\n",
"return",
"m",
"\n",
"}"
] | // NewMessage constructs a new dht message with given type, key, and level | [
"NewMessage",
"constructs",
"a",
"new",
"dht",
"message",
"with",
"given",
"type",
"key",
"and",
"level"
] | fb62272e7ee5e16c07f88c30cb76e0f69e36ab69 | https://github.com/libp2p/go-libp2p-kad-dht/blob/fb62272e7ee5e16c07f88c30cb76e0f69e36ab69/pb/message.go#L20-L27 | train |
libp2p/go-libp2p-kad-dht | pb/message.go | Addresses | func (m *Message_Peer) Addresses() []ma.Multiaddr {
if m == nil {
return nil
}
maddrs := make([]ma.Multiaddr, 0, len(m.Addrs))
for _, addr := range m.Addrs {
maddr, err := ma.NewMultiaddrBytes(addr)
if err != nil {
log.Warningf("error decoding Multiaddr for peer: %s", m.GetId())
continue
}
maddrs = append(maddrs, maddr)
}
return maddrs
} | go | func (m *Message_Peer) Addresses() []ma.Multiaddr {
if m == nil {
return nil
}
maddrs := make([]ma.Multiaddr, 0, len(m.Addrs))
for _, addr := range m.Addrs {
maddr, err := ma.NewMultiaddrBytes(addr)
if err != nil {
log.Warningf("error decoding Multiaddr for peer: %s", m.GetId())
continue
}
maddrs = append(maddrs, maddr)
}
return maddrs
} | [
"func",
"(",
"m",
"*",
"Message_Peer",
")",
"Addresses",
"(",
")",
"[",
"]",
"ma",
".",
"Multiaddr",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"maddrs",
":=",
"make",
"(",
"[",
"]",
"ma",
".",
"Multiaddr",
",",
"0",
",",
"len",
"(",
"m",
".",
"Addrs",
")",
")",
"\n",
"for",
"_",
",",
"addr",
":=",
"range",
"m",
".",
"Addrs",
"{",
"maddr",
",",
"err",
":=",
"ma",
".",
"NewMultiaddrBytes",
"(",
"addr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"m",
".",
"GetId",
"(",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"maddrs",
"=",
"append",
"(",
"maddrs",
",",
"maddr",
")",
"\n",
"}",
"\n",
"return",
"maddrs",
"\n",
"}"
] | // Addresses returns a multiaddr associated with the Message_Peer entry | [
"Addresses",
"returns",
"a",
"multiaddr",
"associated",
"with",
"the",
"Message_Peer",
"entry"
] | fb62272e7ee5e16c07f88c30cb76e0f69e36ab69 | https://github.com/libp2p/go-libp2p-kad-dht/blob/fb62272e7ee5e16c07f88c30cb76e0f69e36ab69/pb/message.go#L104-L120 | train |
libp2p/go-libp2p-kad-dht | pb/message.go | Loggable | func (m *Message) Loggable() map[string]interface{} {
return map[string]interface{}{
"message": map[string]string{
"type": m.Type.String(),
"key": b58.Encode([]byte(m.GetKey())),
},
}
} | go | func (m *Message) Loggable() map[string]interface{} {
return map[string]interface{}{
"message": map[string]string{
"type": m.Type.String(),
"key": b58.Encode([]byte(m.GetKey())),
},
}
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"Loggable",
"(",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"return",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"m",
".",
"Type",
".",
"String",
"(",
")",
",",
"\"",
"\"",
":",
"b58",
".",
"Encode",
"(",
"[",
"]",
"byte",
"(",
"m",
".",
"GetKey",
"(",
")",
")",
")",
",",
"}",
",",
"}",
"\n",
"}"
] | // Loggable turns a Message into machine-readable log output | [
"Loggable",
"turns",
"a",
"Message",
"into",
"machine",
"-",
"readable",
"log",
"output"
] | fb62272e7ee5e16c07f88c30cb76e0f69e36ab69 | https://github.com/libp2p/go-libp2p-kad-dht/blob/fb62272e7ee5e16c07f88c30cb76e0f69e36ab69/pb/message.go#L142-L149 | train |
libp2p/go-libp2p-kad-dht | pb/message.go | ConnectionType | func ConnectionType(c inet.Connectedness) Message_ConnectionType {
switch c {
default:
return Message_NOT_CONNECTED
case inet.NotConnected:
return Message_NOT_CONNECTED
case inet.Connected:
return Message_CONNECTED
case inet.CanConnect:
return Message_CAN_CONNECT
case inet.CannotConnect:
return Message_CANNOT_CONNECT
}
} | go | func ConnectionType(c inet.Connectedness) Message_ConnectionType {
switch c {
default:
return Message_NOT_CONNECTED
case inet.NotConnected:
return Message_NOT_CONNECTED
case inet.Connected:
return Message_CONNECTED
case inet.CanConnect:
return Message_CAN_CONNECT
case inet.CannotConnect:
return Message_CANNOT_CONNECT
}
} | [
"func",
"ConnectionType",
"(",
"c",
"inet",
".",
"Connectedness",
")",
"Message_ConnectionType",
"{",
"switch",
"c",
"{",
"default",
":",
"return",
"Message_NOT_CONNECTED",
"\n",
"case",
"inet",
".",
"NotConnected",
":",
"return",
"Message_NOT_CONNECTED",
"\n",
"case",
"inet",
".",
"Connected",
":",
"return",
"Message_CONNECTED",
"\n",
"case",
"inet",
".",
"CanConnect",
":",
"return",
"Message_CAN_CONNECT",
"\n",
"case",
"inet",
".",
"CannotConnect",
":",
"return",
"Message_CANNOT_CONNECT",
"\n",
"}",
"\n",
"}"
] | // ConnectionType returns a Message_ConnectionType associated with the
// inet.Connectedness. | [
"ConnectionType",
"returns",
"a",
"Message_ConnectionType",
"associated",
"with",
"the",
"inet",
".",
"Connectedness",
"."
] | fb62272e7ee5e16c07f88c30cb76e0f69e36ab69 | https://github.com/libp2p/go-libp2p-kad-dht/blob/fb62272e7ee5e16c07f88c30cb76e0f69e36ab69/pb/message.go#L153-L166 | train |
algolia/algoliasearch-client-go | algolia/opt/rule_contexts.go | RuleContextsEqual | func RuleContextsEqual(o1, o2 *RuleContextsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func RuleContextsEqual(o1, o2 *RuleContextsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"RuleContextsEqual",
"(",
"o1",
",",
"o2",
"*",
"RuleContextsOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // RuleContextsEqual 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. | [
"RuleContextsEqual",
"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/rule_contexts.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/opt/ignore_plurals.go | MarshalJSON | func (o IgnorePluralsOption) MarshalJSON() ([]byte, error) {
if len(o.languages) > 0 {
return json.Marshal(o.languages)
}
return json.Marshal(o.ignorePlurals)
} | go | func (o IgnorePluralsOption) MarshalJSON() ([]byte, error) {
if len(o.languages) > 0 {
return json.Marshal(o.languages)
}
return json.Marshal(o.ignorePlurals)
} | [
"func",
"(",
"o",
"IgnorePluralsOption",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"o",
".",
"languages",
")",
">",
"0",
"{",
"return",
"json",
".",
"Marshal",
"(",
"o",
".",
"languages",
")",
"\n",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"o",
".",
"ignorePlurals",
")",
"\n",
"}"
] | // MarshalJSON implements the json.Marshaler interface for
// IgnorePluralsOption. | [
"MarshalJSON",
"implements",
"the",
"json",
".",
"Marshaler",
"interface",
"for",
"IgnorePluralsOption",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/ignore_plurals.go#L36-L41 | train |
algolia/algoliasearch-client-go | algolia/opt/ignore_plurals.go | UnmarshalJSON | func (o *IgnorePluralsOption) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
return nil
}
if err := json.Unmarshal(data, &o.languages); err == nil {
return nil
}
return json.Unmarshal(data, &o.ignorePlurals)
} | go | func (o *IgnorePluralsOption) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
return nil
}
if err := json.Unmarshal(data, &o.languages); err == nil {
return nil
}
return json.Unmarshal(data, &o.ignorePlurals)
} | [
"func",
"(",
"o",
"*",
"IgnorePluralsOption",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"string",
"(",
"data",
")",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"o",
".",
"languages",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"o",
".",
"ignorePlurals",
")",
"\n",
"}"
] | // UnmarshalJSON implements the json.Unmarshaler interface for
// IgnorePluralsOption. | [
"UnmarshalJSON",
"implements",
"the",
"json",
".",
"Unmarshaler",
"interface",
"for",
"IgnorePluralsOption",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/ignore_plurals.go#L45-L55 | train |
algolia/algoliasearch-client-go | algolia/opt/ignore_plurals.go | IgnorePluralsEqual | func IgnorePluralsEqual(o1, o2 *IgnorePluralsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func IgnorePluralsEqual(o1, o2 *IgnorePluralsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"IgnorePluralsEqual",
"(",
"o1",
",",
"o2",
"*",
"IgnorePluralsOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // IgnorePluralsEqual 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. | [
"IgnorePluralsEqual",
"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/ignore_plurals.go#L70-L78 | train |
algolia/algoliasearch-client-go | algolia/opt/faceting_after_distinct.go | FacetingAfterDistinctEqual | func FacetingAfterDistinctEqual(o1, o2 *FacetingAfterDistinctOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func FacetingAfterDistinctEqual(o1, o2 *FacetingAfterDistinctOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"FacetingAfterDistinctEqual",
"(",
"o1",
",",
"o2",
"*",
"FacetingAfterDistinctOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // FacetingAfterDistinctEqual 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. | [
"FacetingAfterDistinctEqual",
"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/faceting_after_distinct.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/response_fields.go | ResponseFieldsEqual | func ResponseFieldsEqual(o1, o2 *ResponseFieldsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func ResponseFieldsEqual(o1, o2 *ResponseFieldsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"ResponseFieldsEqual",
"(",
"o1",
",",
"o2",
"*",
"ResponseFieldsOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // ResponseFieldsEqual 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. | [
"ResponseFieldsEqual",
"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/response_fields.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/allow_compression_of_integer_array.go | ExtractAllowCompressionOfIntegerArray | func ExtractAllowCompressionOfIntegerArray(opts ...interface{}) *opt.AllowCompressionOfIntegerArrayOption {
for _, o := range opts {
if v, ok := o.(*opt.AllowCompressionOfIntegerArrayOption); ok {
return v
}
}
return nil
} | go | func ExtractAllowCompressionOfIntegerArray(opts ...interface{}) *opt.AllowCompressionOfIntegerArrayOption {
for _, o := range opts {
if v, ok := o.(*opt.AllowCompressionOfIntegerArrayOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractAllowCompressionOfIntegerArray",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"AllowCompressionOfIntegerArrayOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"AllowCompressionOfIntegerArrayOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractAllowCompressionOfIntegerArray returns the first found AllowCompressionOfIntegerArrayOption from the
// given variadic arguments or nil otherwise. | [
"ExtractAllowCompressionOfIntegerArray",
"returns",
"the",
"first",
"found",
"AllowCompressionOfIntegerArrayOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/allow_compression_of_integer_array.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/replicas.go | ReplicasEqual | func ReplicasEqual(o1, o2 *ReplicasOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func ReplicasEqual(o1, o2 *ReplicasOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"ReplicasEqual",
"(",
"o1",
",",
"o2",
"*",
"ReplicasOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // ReplicasEqual 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. | [
"ReplicasEqual",
"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/replicas.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/opt/keep_diacritics_on_characters.go | KeepDiacriticsOnCharactersEqual | func KeepDiacriticsOnCharactersEqual(o1, o2 *KeepDiacriticsOnCharactersOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func KeepDiacriticsOnCharactersEqual(o1, o2 *KeepDiacriticsOnCharactersOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"KeepDiacriticsOnCharactersEqual",
"(",
"o1",
",",
"o2",
"*",
"KeepDiacriticsOnCharactersOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // KeepDiacriticsOnCharactersEqual 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. | [
"KeepDiacriticsOnCharactersEqual",
"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/keep_diacritics_on_characters.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/rand/time.go | Duration | func Duration(max time.Duration) time.Duration {
nbNanoseconds := 1 + int(rand.Int63n(max.Nanoseconds()))
return time.Duration(nbNanoseconds) * time.Nanosecond
} | go | func Duration(max time.Duration) time.Duration {
nbNanoseconds := 1 + int(rand.Int63n(max.Nanoseconds()))
return time.Duration(nbNanoseconds) * time.Nanosecond
} | [
"func",
"Duration",
"(",
"max",
"time",
".",
"Duration",
")",
"time",
".",
"Duration",
"{",
"nbNanoseconds",
":=",
"1",
"+",
"int",
"(",
"rand",
".",
"Int63n",
"(",
"max",
".",
"Nanoseconds",
"(",
")",
")",
")",
"\n",
"return",
"time",
".",
"Duration",
"(",
"nbNanoseconds",
")",
"*",
"time",
".",
"Nanosecond",
"\n",
"}"
] | // Duration returns a random `time.Duration` limited to the given
// `max time.Duration`. | [
"Duration",
"returns",
"a",
"random",
"time",
".",
"Duration",
"limited",
"to",
"the",
"given",
"max",
"time",
".",
"Duration",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/rand/time.go#L14-L17 | train |
algolia/algoliasearch-client-go | algolia/opt/attributes_to_retrieve.go | AttributesToRetrieveEqual | func AttributesToRetrieveEqual(o1, o2 *AttributesToRetrieveOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func AttributesToRetrieveEqual(o1, o2 *AttributesToRetrieveOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"AttributesToRetrieveEqual",
"(",
"o1",
",",
"o2",
"*",
"AttributesToRetrieveOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // AttributesToRetrieveEqual 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. | [
"AttributesToRetrieveEqual",
"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_to_retrieve.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/around_lat_lng.go | ExtractAroundLatLng | func ExtractAroundLatLng(opts ...interface{}) *opt.AroundLatLngOption {
for _, o := range opts {
if v, ok := o.(*opt.AroundLatLngOption); ok {
return v
}
}
return nil
} | go | func ExtractAroundLatLng(opts ...interface{}) *opt.AroundLatLngOption {
for _, o := range opts {
if v, ok := o.(*opt.AroundLatLngOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractAroundLatLng",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"AroundLatLngOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"AroundLatLngOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractAroundLatLng returns the first found AroundLatLngOption from the
// given variadic arguments or nil otherwise. | [
"ExtractAroundLatLng",
"returns",
"the",
"first",
"found",
"AroundLatLngOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/around_lat_lng.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/facets.go | ExtractFacets | func ExtractFacets(opts ...interface{}) *opt.FacetsOption {
for _, o := range opts {
if v, ok := o.(*opt.FacetsOption); ok {
return v
}
}
return nil
} | go | func ExtractFacets(opts ...interface{}) *opt.FacetsOption {
for _, o := range opts {
if v, ok := o.(*opt.FacetsOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractFacets",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"FacetsOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"FacetsOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractFacets returns the first found FacetsOption from the
// given variadic arguments or nil otherwise. | [
"ExtractFacets",
"returns",
"the",
"first",
"found",
"FacetsOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/facets.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/enable_rules.go | EnableRulesEqual | func EnableRulesEqual(o1, o2 *EnableRulesOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func EnableRulesEqual(o1, o2 *EnableRulesOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"EnableRulesEqual",
"(",
"o1",
",",
"o2",
"*",
"EnableRulesOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // EnableRulesEqual 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. | [
"EnableRulesEqual",
"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/enable_rules.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/pagination_limited_to.go | PaginationLimitedToEqual | func PaginationLimitedToEqual(o1, o2 *PaginationLimitedToOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func PaginationLimitedToEqual(o1, o2 *PaginationLimitedToOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"PaginationLimitedToEqual",
"(",
"o1",
",",
"o2",
"*",
"PaginationLimitedToOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // PaginationLimitedToEqual 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. | [
"PaginationLimitedToEqual",
"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/pagination_limited_to.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/wait/group.go | Wait | func Wait(waitables ...Waitable) error {
g := NewGroup()
g.Collect(waitables...)
return g.Wait()
} | go | func Wait(waitables ...Waitable) error {
g := NewGroup()
g.Collect(waitables...)
return g.Wait()
} | [
"func",
"Wait",
"(",
"waitables",
"...",
"Waitable",
")",
"error",
"{",
"g",
":=",
"NewGroup",
"(",
")",
"\n",
"g",
".",
"Collect",
"(",
"waitables",
"...",
")",
"\n",
"return",
"g",
".",
"Wait",
"(",
")",
"\n",
"}"
] | // Wait blocks until all the given `algolia.Waitable` objects have completed. If
// one of the objects returned an error upon `Wait` invocation, this error is
// returned. Otherwise, nil is returned. | [
"Wait",
"blocks",
"until",
"all",
"the",
"given",
"algolia",
".",
"Waitable",
"objects",
"have",
"completed",
".",
"If",
"one",
"of",
"the",
"objects",
"returned",
"an",
"error",
"upon",
"Wait",
"invocation",
"this",
"error",
"is",
"returned",
".",
"Otherwise",
"nil",
"is",
"returned",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/wait/group.go#L23-L27 | train |
algolia/algoliasearch-client-go | algolia/wait/group.go | Collect | func (a *Group) Collect(waitables ...Waitable) {
a.Lock()
a.waitables = append(a.waitables, waitables...)
a.Unlock()
} | go | func (a *Group) Collect(waitables ...Waitable) {
a.Lock()
a.waitables = append(a.waitables, waitables...)
a.Unlock()
} | [
"func",
"(",
"a",
"*",
"Group",
")",
"Collect",
"(",
"waitables",
"...",
"Waitable",
")",
"{",
"a",
".",
"Lock",
"(",
")",
"\n",
"a",
".",
"waitables",
"=",
"append",
"(",
"a",
".",
"waitables",
",",
"waitables",
"...",
")",
"\n",
"a",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // Collect holds references to the given `algolia.Waitable` objects in order to
// wait for their completion once the `Wait` method will be invoked. Calling
// `Collect` from multiple goroutines is safe. | [
"Collect",
"holds",
"references",
"to",
"the",
"given",
"algolia",
".",
"Waitable",
"objects",
"in",
"order",
"to",
"wait",
"for",
"their",
"completion",
"once",
"the",
"Wait",
"method",
"will",
"be",
"invoked",
".",
"Calling",
"Collect",
"from",
"multiple",
"goroutines",
"is",
"safe",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/wait/group.go#L32-L36 | train |
algolia/algoliasearch-client-go | algolia/wait/group.go | Wait | func (a *Group) Wait() error {
a.Lock()
defer a.Unlock()
var wg sync.WaitGroup
errs := make(chan error, len(a.waitables))
for _, w := range a.waitables {
wg.Add(1)
go func(wg *sync.WaitGroup, w Waitable, errs chan<- error) {
errs <- w.Wait()
wg.Done()
}(&wg, w, errs)
}
wg.Wait()
close(errs)
a.waitables = nil
for err := range errs {
if err != nil {
return err
}
}
return nil
} | go | func (a *Group) Wait() error {
a.Lock()
defer a.Unlock()
var wg sync.WaitGroup
errs := make(chan error, len(a.waitables))
for _, w := range a.waitables {
wg.Add(1)
go func(wg *sync.WaitGroup, w Waitable, errs chan<- error) {
errs <- w.Wait()
wg.Done()
}(&wg, w, errs)
}
wg.Wait()
close(errs)
a.waitables = nil
for err := range errs {
if err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"a",
"*",
"Group",
")",
"Wait",
"(",
")",
"error",
"{",
"a",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"Unlock",
"(",
")",
"\n\n",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"errs",
":=",
"make",
"(",
"chan",
"error",
",",
"len",
"(",
"a",
".",
"waitables",
")",
")",
"\n\n",
"for",
"_",
",",
"w",
":=",
"range",
"a",
".",
"waitables",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
"wg",
"*",
"sync",
".",
"WaitGroup",
",",
"w",
"Waitable",
",",
"errs",
"chan",
"<-",
"error",
")",
"{",
"errs",
"<-",
"w",
".",
"Wait",
"(",
")",
"\n",
"wg",
".",
"Done",
"(",
")",
"\n",
"}",
"(",
"&",
"wg",
",",
"w",
",",
"errs",
")",
"\n",
"}",
"\n\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"errs",
")",
"\n",
"a",
".",
"waitables",
"=",
"nil",
"\n\n",
"for",
"err",
":=",
"range",
"errs",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Wait blocks until all the collected `algolia.Waitable` objects have
// completed. If one of the objects returned an error upon `Wait` invocation,
// this error is returned. Otherwise, nil is returned. Calling `Wait` from
// multiple goroutines is safe.
//
// Upon successful completion, the `Group` object can be reused directly to
// collect other `algolia.Waitable` objects. | [
"Wait",
"blocks",
"until",
"all",
"the",
"collected",
"algolia",
".",
"Waitable",
"objects",
"have",
"completed",
".",
"If",
"one",
"of",
"the",
"objects",
"returned",
"an",
"error",
"upon",
"Wait",
"invocation",
"this",
"error",
"is",
"returned",
".",
"Otherwise",
"nil",
"is",
"returned",
".",
"Calling",
"Wait",
"from",
"multiple",
"goroutines",
"is",
"safe",
".",
"Upon",
"successful",
"completion",
"the",
"Group",
"object",
"can",
"be",
"reused",
"directly",
"to",
"collect",
"other",
"algolia",
".",
"Waitable",
"objects",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/wait/group.go#L45-L71 | train |
algolia/algoliasearch-client-go | algolia/opt/sort_facet_values_by.go | SortFacetValuesByEqual | func SortFacetValuesByEqual(o1, o2 *SortFacetValuesByOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func SortFacetValuesByEqual(o1, o2 *SortFacetValuesByOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"SortFacetValuesByEqual",
"(",
"o1",
",",
"o2",
"*",
"SortFacetValuesByOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // SortFacetValuesByEqual 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. | [
"SortFacetValuesByEqual",
"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/sort_facet_values_by.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/separators_to_index.go | ExtractSeparatorsToIndex | func ExtractSeparatorsToIndex(opts ...interface{}) *opt.SeparatorsToIndexOption {
for _, o := range opts {
if v, ok := o.(*opt.SeparatorsToIndexOption); ok {
return v
}
}
return nil
} | go | func ExtractSeparatorsToIndex(opts ...interface{}) *opt.SeparatorsToIndexOption {
for _, o := range opts {
if v, ok := o.(*opt.SeparatorsToIndexOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractSeparatorsToIndex",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"SeparatorsToIndexOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"SeparatorsToIndexOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractSeparatorsToIndex returns the first found SeparatorsToIndexOption from the
// given variadic arguments or nil otherwise. | [
"ExtractSeparatorsToIndex",
"returns",
"the",
"first",
"found",
"SeparatorsToIndexOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/separators_to_index.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/extra_headers.go | ExtractExtraHeaders | func ExtractExtraHeaders(opts ...interface{}) *opt.ExtraHeadersOption {
merged := make(map[string]string)
for _, o := range opts {
if v, ok := o.(*opt.ExtraHeadersOption); ok {
for key, value := range v.Get() {
merged[key] = value
}
}
}
if len(merged) == 0 {
return nil
}
return opt.ExtraHeaders(merged)
} | go | func ExtractExtraHeaders(opts ...interface{}) *opt.ExtraHeadersOption {
merged := make(map[string]string)
for _, o := range opts {
if v, ok := o.(*opt.ExtraHeadersOption); ok {
for key, value := range v.Get() {
merged[key] = value
}
}
}
if len(merged) == 0 {
return nil
}
return opt.ExtraHeaders(merged)
} | [
"func",
"ExtractExtraHeaders",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"ExtraHeadersOption",
"{",
"merged",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n\n",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"ExtraHeadersOption",
")",
";",
"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",
".",
"ExtraHeaders",
"(",
"merged",
")",
"\n",
"}"
] | // ExtractExtraHeaders returns the first found ExtraHeadersOption from the
// given variadic arguments or nil otherwise. If multiple options are found, the
// inner maps are merged. | [
"ExtractExtraHeaders",
"returns",
"the",
"first",
"found",
"ExtraHeadersOption",
"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_headers.go#L12-L28 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/typo_tolerance.go | ExtractTypoTolerance | func ExtractTypoTolerance(opts ...interface{}) *opt.TypoToleranceOption {
for _, o := range opts {
if v, ok := o.(*opt.TypoToleranceOption); ok {
return v
}
}
return nil
} | go | func ExtractTypoTolerance(opts ...interface{}) *opt.TypoToleranceOption {
for _, o := range opts {
if v, ok := o.(*opt.TypoToleranceOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractTypoTolerance",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"TypoToleranceOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"TypoToleranceOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractTypoTolerance returns the first found TypoToleranceOption from the
// given variadic arguments or nil otherwise. | [
"ExtractTypoTolerance",
"returns",
"the",
"first",
"found",
"TypoToleranceOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/typo_tolerance.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/attributes_to_highlight.go | AttributesToHighlightEqual | func AttributesToHighlightEqual(o1, o2 *AttributesToHighlightOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func AttributesToHighlightEqual(o1, o2 *AttributesToHighlightOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"AttributesToHighlightEqual",
"(",
"o1",
",",
"o2",
"*",
"AttributesToHighlightOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // AttributesToHighlightEqual 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. | [
"AttributesToHighlightEqual",
"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_to_highlight.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/search/client_keys.go | GetAPIKey | func (c *Client) GetAPIKey(keyID string, opts ...interface{}) (key Key, err error) {
path := c.path("/keys/%s", keyID)
err = c.transport.Request(&key, http.MethodGet, path, nil, call.Read, opts...)
key.Value = keyID
return
} | go | func (c *Client) GetAPIKey(keyID string, opts ...interface{}) (key Key, err error) {
path := c.path("/keys/%s", keyID)
err = c.transport.Request(&key, http.MethodGet, path, nil, call.Read, opts...)
key.Value = keyID
return
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetAPIKey",
"(",
"keyID",
"string",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"key",
"Key",
",",
"err",
"error",
")",
"{",
"path",
":=",
"c",
".",
"path",
"(",
"\"",
"\"",
",",
"keyID",
")",
"\n",
"err",
"=",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"key",
",",
"http",
".",
"MethodGet",
",",
"path",
",",
"nil",
",",
"call",
".",
"Read",
",",
"opts",
"...",
")",
"\n",
"key",
".",
"Value",
"=",
"keyID",
"\n",
"return",
"\n",
"}"
] | // GetAPIKey retrieves the API key identified by the given keyID. | [
"GetAPIKey",
"retrieves",
"the",
"API",
"key",
"identified",
"by",
"the",
"given",
"keyID",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client_keys.go#L11-L16 | train |
algolia/algoliasearch-client-go | algolia/search/client_keys.go | AddAPIKey | func (c *Client) AddAPIKey(key Key, opts ...interface{}) (res CreateKeyRes, err error) {
path := c.path("/keys")
err = c.transport.Request(&res, http.MethodPost, path, key, call.Write, opts...)
res.wait = c.waitKeyIsAvailable(res.Key)
return
} | go | func (c *Client) AddAPIKey(key Key, opts ...interface{}) (res CreateKeyRes, err error) {
path := c.path("/keys")
err = c.transport.Request(&res, http.MethodPost, path, key, call.Write, opts...)
res.wait = c.waitKeyIsAvailable(res.Key)
return
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddAPIKey",
"(",
"key",
"Key",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"CreateKeyRes",
",",
"err",
"error",
")",
"{",
"path",
":=",
"c",
".",
"path",
"(",
"\"",
"\"",
")",
"\n",
"err",
"=",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodPost",
",",
"path",
",",
"key",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"c",
".",
"waitKeyIsAvailable",
"(",
"res",
".",
"Key",
")",
"\n",
"return",
"\n",
"}"
] | // AddAPIKey creates a new API key. Once created, the key can be referenced by
// other methods via the Key field of the response which represents its keyID. | [
"AddAPIKey",
"creates",
"a",
"new",
"API",
"key",
".",
"Once",
"created",
"the",
"key",
"can",
"be",
"referenced",
"by",
"other",
"methods",
"via",
"the",
"Key",
"field",
"of",
"the",
"response",
"which",
"represents",
"its",
"keyID",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client_keys.go#L20-L25 | train |
algolia/algoliasearch-client-go | algolia/search/client_keys.go | UpdateAPIKey | func (c *Client) UpdateAPIKey(key Key, opts ...interface{}) (res UpdateKeyRes, err error) {
if key.Value == "" {
err = errs.ErrMissingKeyID
return
}
path := c.path("/keys/%s", key.Value)
err = c.transport.Request(&res, http.MethodPut, path, key, call.Write, opts...)
res.wait = c.waitKeyHasChanged(key)
return
} | go | func (c *Client) UpdateAPIKey(key Key, opts ...interface{}) (res UpdateKeyRes, err error) {
if key.Value == "" {
err = errs.ErrMissingKeyID
return
}
path := c.path("/keys/%s", key.Value)
err = c.transport.Request(&res, http.MethodPut, path, key, call.Write, opts...)
res.wait = c.waitKeyHasChanged(key)
return
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateAPIKey",
"(",
"key",
"Key",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"UpdateKeyRes",
",",
"err",
"error",
")",
"{",
"if",
"key",
".",
"Value",
"==",
"\"",
"\"",
"{",
"err",
"=",
"errs",
".",
"ErrMissingKeyID",
"\n",
"return",
"\n",
"}",
"\n",
"path",
":=",
"c",
".",
"path",
"(",
"\"",
"\"",
",",
"key",
".",
"Value",
")",
"\n",
"err",
"=",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodPut",
",",
"path",
",",
"key",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"c",
".",
"waitKeyHasChanged",
"(",
"key",
")",
"\n",
"return",
"\n",
"}"
] | // UpdateAPIKey updates the API key identified by its Value field and updates
// all its non-zero fields. | [
"UpdateAPIKey",
"updates",
"the",
"API",
"key",
"identified",
"by",
"its",
"Value",
"field",
"and",
"updates",
"all",
"its",
"non",
"-",
"zero",
"fields",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client_keys.go#L29-L38 | train |
algolia/algoliasearch-client-go | algolia/search/client_keys.go | DeleteAPIKey | func (c *Client) DeleteAPIKey(keyID string, opts ...interface{}) (res DeleteKeyRes, err error) {
path := c.path("/keys/%s", keyID)
err = c.transport.Request(&res, http.MethodDelete, path, nil, call.Write, opts...)
res.wait = c.waitKeyIsNotAvailable(keyID)
return
} | go | func (c *Client) DeleteAPIKey(keyID string, opts ...interface{}) (res DeleteKeyRes, err error) {
path := c.path("/keys/%s", keyID)
err = c.transport.Request(&res, http.MethodDelete, path, nil, call.Write, opts...)
res.wait = c.waitKeyIsNotAvailable(keyID)
return
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteAPIKey",
"(",
"keyID",
"string",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"DeleteKeyRes",
",",
"err",
"error",
")",
"{",
"path",
":=",
"c",
".",
"path",
"(",
"\"",
"\"",
",",
"keyID",
")",
"\n",
"err",
"=",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodDelete",
",",
"path",
",",
"nil",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"c",
".",
"waitKeyIsNotAvailable",
"(",
"keyID",
")",
"\n",
"return",
"\n",
"}"
] | // DeleteAPIKey deletes the API key for the given keyID.
//
// To restore a deleted key, you can use RestoreAPIKey with the same keyID. | [
"DeleteAPIKey",
"deletes",
"the",
"API",
"key",
"for",
"the",
"given",
"keyID",
".",
"To",
"restore",
"a",
"deleted",
"key",
"you",
"can",
"use",
"RestoreAPIKey",
"with",
"the",
"same",
"keyID",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client_keys.go#L43-L48 | train |
algolia/algoliasearch-client-go | algolia/search/client_keys.go | RestoreAPIKey | func (c *Client) RestoreAPIKey(keyID string, opts ...interface{}) (res RestoreKeyRes, err error) {
path := c.path("/keys/%s/restore", keyID)
err = c.transport.Request(&res, http.MethodPost, path, nil, call.Write, opts...)
res.wait = c.waitKeyIsAvailable(keyID)
return
} | go | func (c *Client) RestoreAPIKey(keyID string, opts ...interface{}) (res RestoreKeyRes, err error) {
path := c.path("/keys/%s/restore", keyID)
err = c.transport.Request(&res, http.MethodPost, path, nil, call.Write, opts...)
res.wait = c.waitKeyIsAvailable(keyID)
return
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RestoreAPIKey",
"(",
"keyID",
"string",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"RestoreKeyRes",
",",
"err",
"error",
")",
"{",
"path",
":=",
"c",
".",
"path",
"(",
"\"",
"\"",
",",
"keyID",
")",
"\n",
"err",
"=",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodPost",
",",
"path",
",",
"nil",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"c",
".",
"waitKeyIsAvailable",
"(",
"keyID",
")",
"\n",
"return",
"\n",
"}"
] | // RestoreAPIKey restores the API key for the given keyID if it ever existed. | [
"RestoreAPIKey",
"restores",
"the",
"API",
"key",
"for",
"the",
"given",
"keyID",
"if",
"it",
"ever",
"existed",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client_keys.go#L51-L56 | train |
algolia/algoliasearch-client-go | algolia/search/client_keys.go | ListAPIKeys | func (c *Client) ListAPIKeys(opts ...interface{}) (res ListAPIKeysRes, err error) {
path := c.path("/keys")
err = c.transport.Request(&res, http.MethodGet, path, nil, call.Read, opts...)
return
} | go | func (c *Client) ListAPIKeys(opts ...interface{}) (res ListAPIKeysRes, err error) {
path := c.path("/keys")
err = c.transport.Request(&res, http.MethodGet, path, nil, call.Read, opts...)
return
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListAPIKeys",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"ListAPIKeysRes",
",",
"err",
"error",
")",
"{",
"path",
":=",
"c",
".",
"path",
"(",
"\"",
"\"",
")",
"\n",
"err",
"=",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodGet",
",",
"path",
",",
"nil",
",",
"call",
".",
"Read",
",",
"opts",
"...",
")",
"\n",
"return",
"\n",
"}"
] | // ListAPIKeys list all the API keys of the application. | [
"ListAPIKeys",
"list",
"all",
"the",
"API",
"keys",
"of",
"the",
"application",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client_keys.go#L59-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/extra_headers.go | ExtraHeadersEqual | func ExtraHeadersEqual(o1, o2 *ExtraHeadersOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func ExtraHeadersEqual(o1, o2 *ExtraHeadersOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"ExtraHeadersEqual",
"(",
"o1",
",",
"o2",
"*",
"ExtraHeadersOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // ExtraHeadersEqual 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. | [
"ExtraHeadersEqual",
"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/extra_headers.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/tag_filters.go | ExtractTagFilters | func ExtractTagFilters(opts ...interface{}) *opt.TagFiltersOption {
for _, o := range opts {
if v, ok := o.(*opt.TagFiltersOption); ok {
return v
}
}
return nil
} | go | func ExtractTagFilters(opts ...interface{}) *opt.TagFiltersOption {
for _, o := range opts {
if v, ok := o.(*opt.TagFiltersOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractTagFilters",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"TagFiltersOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"TagFiltersOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractTagFilters returns the first found TagFiltersOption from the
// given variadic arguments or nil otherwise. | [
"ExtractTagFilters",
"returns",
"the",
"first",
"found",
"TagFiltersOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/tag_filters.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/around_radius.go | ExtractAroundRadius | func ExtractAroundRadius(opts ...interface{}) *opt.AroundRadiusOption {
for _, o := range opts {
if v, ok := o.(*opt.AroundRadiusOption); ok {
return v
}
}
return nil
} | go | func ExtractAroundRadius(opts ...interface{}) *opt.AroundRadiusOption {
for _, o := range opts {
if v, ok := o.(*opt.AroundRadiusOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractAroundRadius",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"AroundRadiusOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"AroundRadiusOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractAroundRadius returns the first found AroundRadiusOption from the
// given variadic arguments or nil otherwise. | [
"ExtractAroundRadius",
"returns",
"the",
"first",
"found",
"AroundRadiusOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/around_radius.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/unretrievable_attributes.go | UnretrievableAttributesEqual | func UnretrievableAttributesEqual(o1, o2 *UnretrievableAttributesOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func UnretrievableAttributesEqual(o1, o2 *UnretrievableAttributesOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"UnretrievableAttributesEqual",
"(",
"o1",
",",
"o2",
"*",
"UnretrievableAttributesOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // UnretrievableAttributesEqual 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. | [
"UnretrievableAttributesEqual",
"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/unretrievable_attributes.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/search/index_synonyms.go | GetSynonym | func (i *Index) GetSynonym(objectID string, opts ...interface{}) (synonym Synonym, err error) {
if objectID == "" {
err = errs.ErrMissingObjectID
return
}
var syn rawSynonym
path := i.path("/synonyms/%s", url.QueryEscape(objectID))
err = i.transport.Request(&syn, http.MethodGet, path, nil, call.Read, opts...)
if err == nil {
synonym = syn.impl
}
return
} | go | func (i *Index) GetSynonym(objectID string, opts ...interface{}) (synonym Synonym, err error) {
if objectID == "" {
err = errs.ErrMissingObjectID
return
}
var syn rawSynonym
path := i.path("/synonyms/%s", url.QueryEscape(objectID))
err = i.transport.Request(&syn, http.MethodGet, path, nil, call.Read, opts...)
if err == nil {
synonym = syn.impl
}
return
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"GetSynonym",
"(",
"objectID",
"string",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"synonym",
"Synonym",
",",
"err",
"error",
")",
"{",
"if",
"objectID",
"==",
"\"",
"\"",
"{",
"err",
"=",
"errs",
".",
"ErrMissingObjectID",
"\n",
"return",
"\n",
"}",
"\n\n",
"var",
"syn",
"rawSynonym",
"\n",
"path",
":=",
"i",
".",
"path",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"objectID",
")",
")",
"\n",
"err",
"=",
"i",
".",
"transport",
".",
"Request",
"(",
"&",
"syn",
",",
"http",
".",
"MethodGet",
",",
"path",
",",
"nil",
",",
"call",
".",
"Read",
",",
"opts",
"...",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"synonym",
"=",
"syn",
".",
"impl",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] | // GetSynonym retrieves the synonym identified by the given objectID. | [
"GetSynonym",
"retrieves",
"the",
"synonym",
"identified",
"by",
"the",
"given",
"objectID",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_synonyms.go#L15-L28 | train |
algolia/algoliasearch-client-go | algolia/search/index_synonyms.go | SaveSynonym | func (i *Index) SaveSynonym(synonym Synonym, opts ...interface{}) (res UpdateTaskRes, err error) {
if synonym.ObjectID() == "" {
err = errs.ErrMissingObjectID
res.wait = noWait
return
}
path := i.path("/synonyms/%s", url.QueryEscape(synonym.ObjectID()))
err = i.transport.Request(&res, http.MethodPut, path, synonym, call.Write, opts...)
res.wait = i.WaitTask
return
} | go | func (i *Index) SaveSynonym(synonym Synonym, opts ...interface{}) (res UpdateTaskRes, err error) {
if synonym.ObjectID() == "" {
err = errs.ErrMissingObjectID
res.wait = noWait
return
}
path := i.path("/synonyms/%s", url.QueryEscape(synonym.ObjectID()))
err = i.transport.Request(&res, http.MethodPut, path, synonym, call.Write, opts...)
res.wait = i.WaitTask
return
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"SaveSynonym",
"(",
"synonym",
"Synonym",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"UpdateTaskRes",
",",
"err",
"error",
")",
"{",
"if",
"synonym",
".",
"ObjectID",
"(",
")",
"==",
"\"",
"\"",
"{",
"err",
"=",
"errs",
".",
"ErrMissingObjectID",
"\n",
"res",
".",
"wait",
"=",
"noWait",
"\n",
"return",
"\n",
"}",
"\n\n",
"path",
":=",
"i",
".",
"path",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"synonym",
".",
"ObjectID",
"(",
")",
")",
")",
"\n",
"err",
"=",
"i",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodPut",
",",
"path",
",",
"synonym",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"i",
".",
"WaitTask",
"\n",
"return",
"\n",
"}"
] | // SaveSynonym saves the given synonym. | [
"SaveSynonym",
"saves",
"the",
"given",
"synonym",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_synonyms.go#L31-L42 | train |
algolia/algoliasearch-client-go | algolia/search/index_synonyms.go | SaveSynonyms | func (i *Index) SaveSynonyms(synonyms []Synonym, opts ...interface{}) (res UpdateTaskRes, err error) {
if replaceExistingSynonyms := iopt.ExtractReplaceExistingSynonyms(opts...); replaceExistingSynonyms != nil {
opts = opt.InsertExtraURLParam(opts, "replaceExistingSynonyms", replaceExistingSynonyms.Get())
}
path := i.path("/synonyms/batch")
err = i.transport.Request(&res, http.MethodPost, path, synonyms, call.Write, opts...)
res.wait = i.WaitTask
return
} | go | func (i *Index) SaveSynonyms(synonyms []Synonym, opts ...interface{}) (res UpdateTaskRes, err error) {
if replaceExistingSynonyms := iopt.ExtractReplaceExistingSynonyms(opts...); replaceExistingSynonyms != nil {
opts = opt.InsertExtraURLParam(opts, "replaceExistingSynonyms", replaceExistingSynonyms.Get())
}
path := i.path("/synonyms/batch")
err = i.transport.Request(&res, http.MethodPost, path, synonyms, call.Write, opts...)
res.wait = i.WaitTask
return
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"SaveSynonyms",
"(",
"synonyms",
"[",
"]",
"Synonym",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"UpdateTaskRes",
",",
"err",
"error",
")",
"{",
"if",
"replaceExistingSynonyms",
":=",
"iopt",
".",
"ExtractReplaceExistingSynonyms",
"(",
"opts",
"...",
")",
";",
"replaceExistingSynonyms",
"!=",
"nil",
"{",
"opts",
"=",
"opt",
".",
"InsertExtraURLParam",
"(",
"opts",
",",
"\"",
"\"",
",",
"replaceExistingSynonyms",
".",
"Get",
"(",
")",
")",
"\n",
"}",
"\n",
"path",
":=",
"i",
".",
"path",
"(",
"\"",
"\"",
")",
"\n",
"err",
"=",
"i",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodPost",
",",
"path",
",",
"synonyms",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"i",
".",
"WaitTask",
"\n",
"return",
"\n",
"}"
] | // SaveSynonym saves the given synonyms.
//
// Unlike SaveObjects, this method does not batch the given synonyms i.e. all synonyms
// are sent in a single call. | [
"SaveSynonym",
"saves",
"the",
"given",
"synonyms",
".",
"Unlike",
"SaveObjects",
"this",
"method",
"does",
"not",
"batch",
"the",
"given",
"synonyms",
"i",
".",
"e",
".",
"all",
"synonyms",
"are",
"sent",
"in",
"a",
"single",
"call",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_synonyms.go#L48-L56 | train |
algolia/algoliasearch-client-go | algolia/search/index_synonyms.go | ReplaceAllSynonyms | func (i *Index) ReplaceAllSynonyms(synonyms []Synonym, opts ...interface{}) (UpdateTaskRes, error) {
opts = opt.InsertOrReplaceOption(opts, opt.ReplaceExistingSynonyms(true))
return i.SaveSynonyms(synonyms, opts...)
} | go | func (i *Index) ReplaceAllSynonyms(synonyms []Synonym, opts ...interface{}) (UpdateTaskRes, error) {
opts = opt.InsertOrReplaceOption(opts, opt.ReplaceExistingSynonyms(true))
return i.SaveSynonyms(synonyms, opts...)
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"ReplaceAllSynonyms",
"(",
"synonyms",
"[",
"]",
"Synonym",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"UpdateTaskRes",
",",
"error",
")",
"{",
"opts",
"=",
"opt",
".",
"InsertOrReplaceOption",
"(",
"opts",
",",
"opt",
".",
"ReplaceExistingSynonyms",
"(",
"true",
")",
")",
"\n",
"return",
"i",
".",
"SaveSynonyms",
"(",
"synonyms",
",",
"opts",
"...",
")",
"\n",
"}"
] | // ReplaceAllSynonyms replaces any existing synonyms with the given ones. | [
"ReplaceAllSynonyms",
"replaces",
"any",
"existing",
"synonyms",
"with",
"the",
"given",
"ones",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_synonyms.go#L91-L94 | train |
algolia/algoliasearch-client-go | algolia/search/index_synonyms.go | BrowseSynonyms | func (i *Index) BrowseSynonyms(opts ...interface{}) (*SynonymIterator, error) {
opts = opt.InsertOrReplaceOption(opts, opt.HitsPerPage(1000))
res, err := i.SearchSynonyms("", opts...)
if err != nil {
return nil, fmt.Errorf("cannot browse synonyms: search failed: %v", err)
}
synonyms, err := res.Synonyms()
if err != nil {
return nil, fmt.Errorf("cannot browse synonyms: cannot decode synonyms: %v", err)
}
return newSynonymIterator(synonyms), nil
} | go | func (i *Index) BrowseSynonyms(opts ...interface{}) (*SynonymIterator, error) {
opts = opt.InsertOrReplaceOption(opts, opt.HitsPerPage(1000))
res, err := i.SearchSynonyms("", opts...)
if err != nil {
return nil, fmt.Errorf("cannot browse synonyms: search failed: %v", err)
}
synonyms, err := res.Synonyms()
if err != nil {
return nil, fmt.Errorf("cannot browse synonyms: cannot decode synonyms: %v", err)
}
return newSynonymIterator(synonyms), nil
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"BrowseSynonyms",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"*",
"SynonymIterator",
",",
"error",
")",
"{",
"opts",
"=",
"opt",
".",
"InsertOrReplaceOption",
"(",
"opts",
",",
"opt",
".",
"HitsPerPage",
"(",
"1000",
")",
")",
"\n",
"res",
",",
"err",
":=",
"i",
".",
"SearchSynonyms",
"(",
"\"",
"\"",
",",
"opts",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"synonyms",
",",
"err",
":=",
"res",
".",
"Synonyms",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"newSynonymIterator",
"(",
"synonyms",
")",
",",
"nil",
"\n",
"}"
] | // BrowseSynonyms returns an iterator which will retrieve synonyms one by one from the
// index. | [
"BrowseSynonyms",
"returns",
"an",
"iterator",
"which",
"will",
"retrieve",
"synonyms",
"one",
"by",
"one",
"from",
"the",
"index",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_synonyms.go#L98-L109 | train |
algolia/algoliasearch-client-go | algolia/search/client.go | NewClient | func NewClient(appID, apiKey string) *Client {
return NewClientWithConfig(
Configuration{
AppID: appID,
APIKey: apiKey,
},
)
} | go | func NewClient(appID, apiKey string) *Client {
return NewClientWithConfig(
Configuration{
AppID: appID,
APIKey: apiKey,
},
)
} | [
"func",
"NewClient",
"(",
"appID",
",",
"apiKey",
"string",
")",
"*",
"Client",
"{",
"return",
"NewClientWithConfig",
"(",
"Configuration",
"{",
"AppID",
":",
"appID",
",",
"APIKey",
":",
"apiKey",
",",
"}",
",",
")",
"\n",
"}"
] | // NewClient instantiates a new client able to interact with the Algolia
// Search API on multiple indices which belong to the same Algolia application. | [
"NewClient",
"instantiates",
"a",
"new",
"client",
"able",
"to",
"interact",
"with",
"the",
"Algolia",
"Search",
"API",
"on",
"multiple",
"indices",
"which",
"belong",
"to",
"the",
"same",
"Algolia",
"application",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client.go#L29-L36 | train |
algolia/algoliasearch-client-go | algolia/search/client.go | NewClientWithConfig | func NewClientWithConfig(config Configuration) *Client {
var (
hosts []*transport.StatefulHost
maxBatchSize int
)
if len(config.Hosts) == 0 {
hosts = defaultHosts(config.AppID)
} else {
for _, h := range config.Hosts {
hosts = append(hosts, transport.NewStatefulHost(h, call.IsReadWrite))
}
}
if config.MaxBatchSize == 0 {
maxBatchSize = DefaultMaxBatchSize
} else {
maxBatchSize = config.MaxBatchSize
}
return &Client{
appID: config.AppID,
maxBatchSize: maxBatchSize,
transport: transport.New(
hosts,
config.Requester,
config.AppID,
config.APIKey,
config.ReadTimeout,
config.WriteTimeout,
config.Headers,
config.ExtraUserAgent,
),
}
} | go | func NewClientWithConfig(config Configuration) *Client {
var (
hosts []*transport.StatefulHost
maxBatchSize int
)
if len(config.Hosts) == 0 {
hosts = defaultHosts(config.AppID)
} else {
for _, h := range config.Hosts {
hosts = append(hosts, transport.NewStatefulHost(h, call.IsReadWrite))
}
}
if config.MaxBatchSize == 0 {
maxBatchSize = DefaultMaxBatchSize
} else {
maxBatchSize = config.MaxBatchSize
}
return &Client{
appID: config.AppID,
maxBatchSize: maxBatchSize,
transport: transport.New(
hosts,
config.Requester,
config.AppID,
config.APIKey,
config.ReadTimeout,
config.WriteTimeout,
config.Headers,
config.ExtraUserAgent,
),
}
} | [
"func",
"NewClientWithConfig",
"(",
"config",
"Configuration",
")",
"*",
"Client",
"{",
"var",
"(",
"hosts",
"[",
"]",
"*",
"transport",
".",
"StatefulHost",
"\n",
"maxBatchSize",
"int",
"\n",
")",
"\n\n",
"if",
"len",
"(",
"config",
".",
"Hosts",
")",
"==",
"0",
"{",
"hosts",
"=",
"defaultHosts",
"(",
"config",
".",
"AppID",
")",
"\n",
"}",
"else",
"{",
"for",
"_",
",",
"h",
":=",
"range",
"config",
".",
"Hosts",
"{",
"hosts",
"=",
"append",
"(",
"hosts",
",",
"transport",
".",
"NewStatefulHost",
"(",
"h",
",",
"call",
".",
"IsReadWrite",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"config",
".",
"MaxBatchSize",
"==",
"0",
"{",
"maxBatchSize",
"=",
"DefaultMaxBatchSize",
"\n",
"}",
"else",
"{",
"maxBatchSize",
"=",
"config",
".",
"MaxBatchSize",
"\n",
"}",
"\n\n",
"return",
"&",
"Client",
"{",
"appID",
":",
"config",
".",
"AppID",
",",
"maxBatchSize",
":",
"maxBatchSize",
",",
"transport",
":",
"transport",
".",
"New",
"(",
"hosts",
",",
"config",
".",
"Requester",
",",
"config",
".",
"AppID",
",",
"config",
".",
"APIKey",
",",
"config",
".",
"ReadTimeout",
",",
"config",
".",
"WriteTimeout",
",",
"config",
".",
"Headers",
",",
"config",
".",
"ExtraUserAgent",
",",
")",
",",
"}",
"\n",
"}"
] | // NewClientWithConfig instantiates a new client able to interact with the
// Algolia Search API on multiple indices which belong to the same Algolia
// application. | [
"NewClientWithConfig",
"instantiates",
"a",
"new",
"client",
"able",
"to",
"interact",
"with",
"the",
"Algolia",
"Search",
"API",
"on",
"multiple",
"indices",
"which",
"belong",
"to",
"the",
"same",
"Algolia",
"application",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client.go#L41-L75 | train |
algolia/algoliasearch-client-go | algolia/search/client.go | ListIndexes | func (c *Client) ListIndexes(opts ...interface{}) (res ListIndexesRes, err error) {
path := c.path("/indexes")
err = c.transport.Request(&res, http.MethodGet, path, nil, call.Read, opts...)
return
} | go | func (c *Client) ListIndexes(opts ...interface{}) (res ListIndexesRes, err error) {
path := c.path("/indexes")
err = c.transport.Request(&res, http.MethodGet, path, nil, call.Read, opts...)
return
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListIndexes",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"ListIndexesRes",
",",
"err",
"error",
")",
"{",
"path",
":=",
"c",
".",
"path",
"(",
"\"",
"\"",
")",
"\n",
"err",
"=",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodGet",
",",
"path",
",",
"nil",
",",
"call",
".",
"Read",
",",
"opts",
"...",
")",
"\n",
"return",
"\n",
"}"
] | // ListIndexes lists the indices of the Algolia application. The response is
// paginated and hence, may not return all indices in a single call. Multiple
// calls may be necessary to retrieve all indices. | [
"ListIndexes",
"lists",
"the",
"indices",
"of",
"the",
"Algolia",
"application",
".",
"The",
"response",
"is",
"paginated",
"and",
"hence",
"may",
"not",
"return",
"all",
"indices",
"in",
"a",
"single",
"call",
".",
"Multiple",
"calls",
"may",
"be",
"necessary",
"to",
"retrieve",
"all",
"indices",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client.go#L90-L94 | train |
algolia/algoliasearch-client-go | algolia/search/client.go | GetLogs | func (c *Client) GetLogs(opts ...interface{}) (res GetLogsRes, err error) {
if offset := iopt.ExtractOffset(opts...); offset != nil {
opts = opt.InsertExtraURLParam(opts, "offset", offset.Get())
}
if length := iopt.ExtractLength(opts...); length != nil {
opts = opt.InsertExtraURLParam(opts, "length", length.Get())
}
if t := iopt.ExtractType(opts...); t != nil {
opts = opt.InsertExtraURLParam(opts, "type", t.Get())
}
if indexName := iopt.ExtractIndexName(opts...); indexName != nil {
opts = opt.InsertExtraURLParam(opts, "indexName", indexName.Get())
}
path := c.path("/logs")
err = c.transport.Request(&res, http.MethodGet, path, nil, call.Read, opts...)
return
} | go | func (c *Client) GetLogs(opts ...interface{}) (res GetLogsRes, err error) {
if offset := iopt.ExtractOffset(opts...); offset != nil {
opts = opt.InsertExtraURLParam(opts, "offset", offset.Get())
}
if length := iopt.ExtractLength(opts...); length != nil {
opts = opt.InsertExtraURLParam(opts, "length", length.Get())
}
if t := iopt.ExtractType(opts...); t != nil {
opts = opt.InsertExtraURLParam(opts, "type", t.Get())
}
if indexName := iopt.ExtractIndexName(opts...); indexName != nil {
opts = opt.InsertExtraURLParam(opts, "indexName", indexName.Get())
}
path := c.path("/logs")
err = c.transport.Request(&res, http.MethodGet, path, nil, call.Read, opts...)
return
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetLogs",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"GetLogsRes",
",",
"err",
"error",
")",
"{",
"if",
"offset",
":=",
"iopt",
".",
"ExtractOffset",
"(",
"opts",
"...",
")",
";",
"offset",
"!=",
"nil",
"{",
"opts",
"=",
"opt",
".",
"InsertExtraURLParam",
"(",
"opts",
",",
"\"",
"\"",
",",
"offset",
".",
"Get",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"length",
":=",
"iopt",
".",
"ExtractLength",
"(",
"opts",
"...",
")",
";",
"length",
"!=",
"nil",
"{",
"opts",
"=",
"opt",
".",
"InsertExtraURLParam",
"(",
"opts",
",",
"\"",
"\"",
",",
"length",
".",
"Get",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"t",
":=",
"iopt",
".",
"ExtractType",
"(",
"opts",
"...",
")",
";",
"t",
"!=",
"nil",
"{",
"opts",
"=",
"opt",
".",
"InsertExtraURLParam",
"(",
"opts",
",",
"\"",
"\"",
",",
"t",
".",
"Get",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"indexName",
":=",
"iopt",
".",
"ExtractIndexName",
"(",
"opts",
"...",
")",
";",
"indexName",
"!=",
"nil",
"{",
"opts",
"=",
"opt",
".",
"InsertExtraURLParam",
"(",
"opts",
",",
"\"",
"\"",
",",
"indexName",
".",
"Get",
"(",
")",
")",
"\n",
"}",
"\n",
"path",
":=",
"c",
".",
"path",
"(",
"\"",
"\"",
")",
"\n",
"err",
"=",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodGet",
",",
"path",
",",
"nil",
",",
"call",
".",
"Read",
",",
"opts",
"...",
")",
"\n",
"return",
"\n",
"}"
] | // GetLogs returns the most recent information logs of the Algolia application. | [
"GetLogs",
"returns",
"the",
"most",
"recent",
"information",
"logs",
"of",
"the",
"Algolia",
"application",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client.go#L97-L113 | train |
algolia/algoliasearch-client-go | algolia/search/client.go | CustomRequest | func (c *Client) CustomRequest(
res interface{},
method string,
path string,
body interface{},
k call.Kind,
opts ...interface{},
) error {
return c.transport.Request(&res, method, path, body, k, opts...)
} | go | func (c *Client) CustomRequest(
res interface{},
method string,
path string,
body interface{},
k call.Kind,
opts ...interface{},
) error {
return c.transport.Request(&res, method, path, body, k, opts...)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CustomRequest",
"(",
"res",
"interface",
"{",
"}",
",",
"method",
"string",
",",
"path",
"string",
",",
"body",
"interface",
"{",
"}",
",",
"k",
"call",
".",
"Kind",
",",
"opts",
"...",
"interface",
"{",
"}",
",",
")",
"error",
"{",
"return",
"c",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"method",
",",
"path",
",",
"body",
",",
"k",
",",
"opts",
"...",
")",
"\n",
"}"
] | // CustomRequest is a low-level function which build a request from the given
// parameters and send it through the requester, making use of the underlying
// retry strategy. | [
"CustomRequest",
"is",
"a",
"low",
"-",
"level",
"function",
"which",
"build",
"a",
"request",
"from",
"the",
"given",
"parameters",
"and",
"send",
"it",
"through",
"the",
"requester",
"making",
"use",
"of",
"the",
"underlying",
"retry",
"strategy",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/client.go#L118-L127 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/numeric_attributes_for_filtering.go | ExtractNumericAttributesForFiltering | func ExtractNumericAttributesForFiltering(opts ...interface{}) *opt.NumericAttributesForFilteringOption {
for _, o := range opts {
if v, ok := o.(*opt.NumericAttributesForFilteringOption); ok {
return v
}
}
return nil
} | go | func ExtractNumericAttributesForFiltering(opts ...interface{}) *opt.NumericAttributesForFilteringOption {
for _, o := range opts {
if v, ok := o.(*opt.NumericAttributesForFilteringOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractNumericAttributesForFiltering",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"NumericAttributesForFilteringOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"NumericAttributesForFilteringOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractNumericAttributesForFiltering returns the first found NumericAttributesForFilteringOption from the
// given variadic arguments or nil otherwise. | [
"ExtractNumericAttributesForFiltering",
"returns",
"the",
"first",
"found",
"NumericAttributesForFilteringOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/numeric_attributes_for_filtering.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/keep_diacritics_on_characters.go | ExtractKeepDiacriticsOnCharacters | func ExtractKeepDiacriticsOnCharacters(opts ...interface{}) *opt.KeepDiacriticsOnCharactersOption {
for _, o := range opts {
if v, ok := o.(*opt.KeepDiacriticsOnCharactersOption); ok {
return v
}
}
return nil
} | go | func ExtractKeepDiacriticsOnCharacters(opts ...interface{}) *opt.KeepDiacriticsOnCharactersOption {
for _, o := range opts {
if v, ok := o.(*opt.KeepDiacriticsOnCharactersOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractKeepDiacriticsOnCharacters",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"KeepDiacriticsOnCharactersOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"KeepDiacriticsOnCharactersOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractKeepDiacriticsOnCharacters returns the first found KeepDiacriticsOnCharactersOption from the
// given variadic arguments or nil otherwise. | [
"ExtractKeepDiacriticsOnCharacters",
"returns",
"the",
"first",
"found",
"KeepDiacriticsOnCharactersOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/keep_diacritics_on_characters.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/disable_typo_tolerance_on_attributes.go | DisableTypoToleranceOnAttributesEqual | func DisableTypoToleranceOnAttributesEqual(o1, o2 *DisableTypoToleranceOnAttributesOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func DisableTypoToleranceOnAttributesEqual(o1, o2 *DisableTypoToleranceOnAttributesOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"DisableTypoToleranceOnAttributesEqual",
"(",
"o1",
",",
"o2",
"*",
"DisableTypoToleranceOnAttributesOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // DisableTypoToleranceOnAttributesEqual 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. | [
"DisableTypoToleranceOnAttributesEqual",
"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/disable_typo_tolerance_on_attributes.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/max_facet_hits.go | ExtractMaxFacetHits | func ExtractMaxFacetHits(opts ...interface{}) *opt.MaxFacetHitsOption {
for _, o := range opts {
if v, ok := o.(*opt.MaxFacetHitsOption); ok {
return v
}
}
return nil
} | go | func ExtractMaxFacetHits(opts ...interface{}) *opt.MaxFacetHitsOption {
for _, o := range opts {
if v, ok := o.(*opt.MaxFacetHitsOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractMaxFacetHits",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"MaxFacetHitsOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"MaxFacetHitsOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractMaxFacetHits returns the first found MaxFacetHitsOption from the
// given variadic arguments or nil otherwise. | [
"ExtractMaxFacetHits",
"returns",
"the",
"first",
"found",
"MaxFacetHitsOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/max_facet_hits.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/highlight_pre_tag.go | ExtractHighlightPreTag | func ExtractHighlightPreTag(opts ...interface{}) *opt.HighlightPreTagOption {
for _, o := range opts {
if v, ok := o.(*opt.HighlightPreTagOption); ok {
return v
}
}
return nil
} | go | func ExtractHighlightPreTag(opts ...interface{}) *opt.HighlightPreTagOption {
for _, o := range opts {
if v, ok := o.(*opt.HighlightPreTagOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractHighlightPreTag",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"HighlightPreTagOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"HighlightPreTagOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractHighlightPreTag returns the first found HighlightPreTagOption from the
// given variadic arguments or nil otherwise. | [
"ExtractHighlightPreTag",
"returns",
"the",
"first",
"found",
"HighlightPreTagOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/highlight_pre_tag.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/restrict_sources.go | ExtractRestrictSources | func ExtractRestrictSources(opts ...interface{}) *opt.RestrictSourcesOption {
for _, o := range opts {
if v, ok := o.(*opt.RestrictSourcesOption); ok {
return v
}
}
return nil
} | go | func ExtractRestrictSources(opts ...interface{}) *opt.RestrictSourcesOption {
for _, o := range opts {
if v, ok := o.(*opt.RestrictSourcesOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractRestrictSources",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"RestrictSourcesOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"RestrictSourcesOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractRestrictSources returns the first found RestrictSourcesOption from the
// given variadic arguments or nil otherwise. | [
"ExtractRestrictSources",
"returns",
"the",
"first",
"found",
"RestrictSourcesOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/restrict_sources.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/separators_to_index.go | SeparatorsToIndexEqual | func SeparatorsToIndexEqual(o1, o2 *SeparatorsToIndexOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func SeparatorsToIndexEqual(o1, o2 *SeparatorsToIndexOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"SeparatorsToIndexEqual",
"(",
"o1",
",",
"o2",
"*",
"SeparatorsToIndexOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // SeparatorsToIndexEqual 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. | [
"SeparatorsToIndexEqual",
"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/separators_to_index.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/anchoring.go | ExtractAnchoring | func ExtractAnchoring(opts ...interface{}) *opt.AnchoringOption {
for _, o := range opts {
if v, ok := o.(*opt.AnchoringOption); ok {
return v
}
}
return nil
} | go | func ExtractAnchoring(opts ...interface{}) *opt.AnchoringOption {
for _, o := range opts {
if v, ok := o.(*opt.AnchoringOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractAnchoring",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"AnchoringOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"AnchoringOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractAnchoring returns the first found AnchoringOption from the
// given variadic arguments or nil otherwise. | [
"ExtractAnchoring",
"returns",
"the",
"first",
"found",
"AnchoringOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/anchoring.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/restrict_highlight_and_snippet_arrays.go | RestrictHighlightAndSnippetArraysEqual | func RestrictHighlightAndSnippetArraysEqual(o1, o2 *RestrictHighlightAndSnippetArraysOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func RestrictHighlightAndSnippetArraysEqual(o1, o2 *RestrictHighlightAndSnippetArraysOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"RestrictHighlightAndSnippetArraysEqual",
"(",
"o1",
",",
"o2",
"*",
"RestrictHighlightAndSnippetArraysOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // RestrictHighlightAndSnippetArraysEqual 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. | [
"RestrictHighlightAndSnippetArraysEqual",
"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/restrict_highlight_and_snippet_arrays.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/alternatives_as_exact.go | ExtractAlternativesAsExact | func ExtractAlternativesAsExact(opts ...interface{}) *opt.AlternativesAsExactOption {
for _, o := range opts {
if v, ok := o.(*opt.AlternativesAsExactOption); ok {
return v
}
}
return nil
} | go | func ExtractAlternativesAsExact(opts ...interface{}) *opt.AlternativesAsExactOption {
for _, o := range opts {
if v, ok := o.(*opt.AlternativesAsExactOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractAlternativesAsExact",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"AlternativesAsExactOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"AlternativesAsExactOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractAlternativesAsExact returns the first found AlternativesAsExactOption from the
// given variadic arguments or nil otherwise. | [
"ExtractAlternativesAsExact",
"returns",
"the",
"first",
"found",
"AlternativesAsExactOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/alternatives_as_exact.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/snippet_ellipsis_text.go | ExtractSnippetEllipsisText | func ExtractSnippetEllipsisText(opts ...interface{}) *opt.SnippetEllipsisTextOption {
for _, o := range opts {
if v, ok := o.(*opt.SnippetEllipsisTextOption); ok {
return v
}
}
return nil
} | go | func ExtractSnippetEllipsisText(opts ...interface{}) *opt.SnippetEllipsisTextOption {
for _, o := range opts {
if v, ok := o.(*opt.SnippetEllipsisTextOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractSnippetEllipsisText",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"SnippetEllipsisTextOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"SnippetEllipsisTextOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractSnippetEllipsisText returns the first found SnippetEllipsisTextOption from the
// given variadic arguments or nil otherwise. | [
"ExtractSnippetEllipsisText",
"returns",
"the",
"first",
"found",
"SnippetEllipsisTextOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/snippet_ellipsis_text.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/response_fields.go | ExtractResponseFields | func ExtractResponseFields(opts ...interface{}) *opt.ResponseFieldsOption {
for _, o := range opts {
if v, ok := o.(*opt.ResponseFieldsOption); ok {
return v
}
}
return nil
} | go | func ExtractResponseFields(opts ...interface{}) *opt.ResponseFieldsOption {
for _, o := range opts {
if v, ok := o.(*opt.ResponseFieldsOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractResponseFields",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"ResponseFieldsOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"ResponseFieldsOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractResponseFields returns the first found ResponseFieldsOption from the
// given variadic arguments or nil otherwise. | [
"ExtractResponseFields",
"returns",
"the",
"first",
"found",
"ResponseFieldsOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/response_fields.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/offset.go | OffsetEqual | func OffsetEqual(o1, o2 *OffsetOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func OffsetEqual(o1, o2 *OffsetOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"OffsetEqual",
"(",
"o1",
",",
"o2",
"*",
"OffsetOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // OffsetEqual 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. | [
"OffsetEqual",
"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/offset.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/disable_typo_tolerance_on_attributes.go | ExtractDisableTypoToleranceOnAttributes | func ExtractDisableTypoToleranceOnAttributes(opts ...interface{}) *opt.DisableTypoToleranceOnAttributesOption {
for _, o := range opts {
if v, ok := o.(*opt.DisableTypoToleranceOnAttributesOption); ok {
return v
}
}
return nil
} | go | func ExtractDisableTypoToleranceOnAttributes(opts ...interface{}) *opt.DisableTypoToleranceOnAttributesOption {
for _, o := range opts {
if v, ok := o.(*opt.DisableTypoToleranceOnAttributesOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractDisableTypoToleranceOnAttributes",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"DisableTypoToleranceOnAttributesOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"DisableTypoToleranceOnAttributesOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractDisableTypoToleranceOnAttributes returns the first found DisableTypoToleranceOnAttributesOption from the
// given variadic arguments or nil otherwise. | [
"ExtractDisableTypoToleranceOnAttributes",
"returns",
"the",
"first",
"found",
"DisableTypoToleranceOnAttributesOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/disable_typo_tolerance_on_attributes.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/query_type.go | QueryTypeEqual | func QueryTypeEqual(o1, o2 *QueryTypeOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func QueryTypeEqual(o1, o2 *QueryTypeOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"QueryTypeEqual",
"(",
"o1",
",",
"o2",
"*",
"QueryTypeOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // QueryTypeEqual 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. | [
"QueryTypeEqual",
"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_type.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/restrict_indices.go | ExtractRestrictIndices | func ExtractRestrictIndices(opts ...interface{}) *opt.RestrictIndicesOption {
for _, o := range opts {
if v, ok := o.(*opt.RestrictIndicesOption); ok {
return v
}
}
return nil
} | go | func ExtractRestrictIndices(opts ...interface{}) *opt.RestrictIndicesOption {
for _, o := range opts {
if v, ok := o.(*opt.RestrictIndicesOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractRestrictIndices",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"RestrictIndicesOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"RestrictIndicesOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractRestrictIndices returns the first found RestrictIndicesOption from the
// given variadic arguments or nil otherwise. | [
"ExtractRestrictIndices",
"returns",
"the",
"first",
"found",
"RestrictIndicesOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/restrict_indices.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/inside_polygon.go | MarshalJSON | func (o InsidePolygonOption) MarshalJSON() ([]byte, error) {
if o.coordinates != "" {
return json.Marshal(o.coordinates)
}
return json.Marshal(o.polygons)
} | go | func (o InsidePolygonOption) MarshalJSON() ([]byte, error) {
if o.coordinates != "" {
return json.Marshal(o.coordinates)
}
return json.Marshal(o.polygons)
} | [
"func",
"(",
"o",
"InsidePolygonOption",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"o",
".",
"coordinates",
"!=",
"\"",
"\"",
"{",
"return",
"json",
".",
"Marshal",
"(",
"o",
".",
"coordinates",
")",
"\n",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"o",
".",
"polygons",
")",
"\n",
"}"
] | // MarshalJSON implements the json.Marshaler interface for
// InsidePolygonOption. | [
"MarshalJSON",
"implements",
"the",
"json",
".",
"Marshaler",
"interface",
"for",
"InsidePolygonOption",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/inside_polygon.go#L39-L44 | train |
algolia/algoliasearch-client-go | algolia/opt/inside_polygon.go | UnmarshalJSON | func (o *InsidePolygonOption) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
return nil
}
var polygons [][]float64
if err := json.Unmarshal(data, &polygons); err == nil {
o.polygons = polygons
return nil
}
var coordinates string
if err := json.Unmarshal(data, &coordinates); err == nil {
o.coordinates = coordinates
return nil
}
return errs.ErrJSONDecode(data, "InsidePolygon")
} | go | func (o *InsidePolygonOption) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
return nil
}
var polygons [][]float64
if err := json.Unmarshal(data, &polygons); err == nil {
o.polygons = polygons
return nil
}
var coordinates string
if err := json.Unmarshal(data, &coordinates); err == nil {
o.coordinates = coordinates
return nil
}
return errs.ErrJSONDecode(data, "InsidePolygon")
} | [
"func",
"(",
"o",
"*",
"InsidePolygonOption",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"string",
"(",
"data",
")",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"polygons",
"[",
"]",
"[",
"]",
"float64",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"polygons",
")",
";",
"err",
"==",
"nil",
"{",
"o",
".",
"polygons",
"=",
"polygons",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"coordinates",
"string",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"coordinates",
")",
";",
"err",
"==",
"nil",
"{",
"o",
".",
"coordinates",
"=",
"coordinates",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"errs",
".",
"ErrJSONDecode",
"(",
"data",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // UnmarshalJSON implements the json.Unmarshaler interface for
// InsidePolygonOption. | [
"UnmarshalJSON",
"implements",
"the",
"json",
".",
"Unmarshaler",
"interface",
"for",
"InsidePolygonOption",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/inside_polygon.go#L48-L66 | train |
algolia/algoliasearch-client-go | algolia/opt/inside_polygon.go | InsidePolygonEqual | func InsidePolygonEqual(o1, o2 *InsidePolygonOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func InsidePolygonEqual(o1, o2 *InsidePolygonOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"InsidePolygonEqual",
"(",
"o1",
",",
"o2",
"*",
"InsidePolygonOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // InsidePolygonEqual 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. | [
"InsidePolygonEqual",
"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/inside_polygon.go#L81-L89 | train |
algolia/algoliasearch-client-go | algolia/opt/advanced_syntax.go | AdvancedSyntaxEqual | func AdvancedSyntaxEqual(o1, o2 *AdvancedSyntaxOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func AdvancedSyntaxEqual(o1, o2 *AdvancedSyntaxOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"AdvancedSyntaxEqual",
"(",
"o1",
",",
"o2",
"*",
"AdvancedSyntaxOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // AdvancedSyntaxEqual 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. | [
"AdvancedSyntaxEqual",
"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_syntax.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/pagination_limited_to.go | ExtractPaginationLimitedTo | func ExtractPaginationLimitedTo(opts ...interface{}) *opt.PaginationLimitedToOption {
for _, o := range opts {
if v, ok := o.(*opt.PaginationLimitedToOption); ok {
return v
}
}
return nil
} | go | func ExtractPaginationLimitedTo(opts ...interface{}) *opt.PaginationLimitedToOption {
for _, o := range opts {
if v, ok := o.(*opt.PaginationLimitedToOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractPaginationLimitedTo",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"PaginationLimitedToOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"PaginationLimitedToOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractPaginationLimitedTo returns the first found PaginationLimitedToOption from the
// given variadic arguments or nil otherwise. | [
"ExtractPaginationLimitedTo",
"returns",
"the",
"first",
"found",
"PaginationLimitedToOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/pagination_limited_to.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/min_word_sizefor2_typos.go | ExtractMinWordSizefor2Typos | func ExtractMinWordSizefor2Typos(opts ...interface{}) *opt.MinWordSizefor2TyposOption {
for _, o := range opts {
if v, ok := o.(*opt.MinWordSizefor2TyposOption); ok {
return v
}
}
return nil
} | go | func ExtractMinWordSizefor2Typos(opts ...interface{}) *opt.MinWordSizefor2TyposOption {
for _, o := range opts {
if v, ok := o.(*opt.MinWordSizefor2TyposOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractMinWordSizefor2Typos",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"MinWordSizefor2TyposOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"MinWordSizefor2TyposOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractMinWordSizefor2Typos returns the first found MinWordSizefor2TyposOption from the
// given variadic arguments or nil otherwise. | [
"ExtractMinWordSizefor2Typos",
"returns",
"the",
"first",
"found",
"MinWordSizefor2TyposOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/min_word_sizefor2_typos.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/highlight_pre_tag.go | HighlightPreTagEqual | func HighlightPreTagEqual(o1, o2 *HighlightPreTagOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func HighlightPreTagEqual(o1, o2 *HighlightPreTagOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"HighlightPreTagEqual",
"(",
"o1",
",",
"o2",
"*",
"HighlightPreTagOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // HighlightPreTagEqual 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. | [
"HighlightPreTagEqual",
"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_pre_tag.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/min_word_sizefor2_typos.go | MinWordSizefor2TyposEqual | func MinWordSizefor2TyposEqual(o1, o2 *MinWordSizefor2TyposOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func MinWordSizefor2TyposEqual(o1, o2 *MinWordSizefor2TyposOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"MinWordSizefor2TyposEqual",
"(",
"o1",
",",
"o2",
"*",
"MinWordSizefor2TyposOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // MinWordSizefor2TyposEqual 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. | [
"MinWordSizefor2TyposEqual",
"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_sizefor2_typos.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/analytics_tags.go | AnalyticsTagsEqual | func AnalyticsTagsEqual(o1, o2 *AnalyticsTagsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func AnalyticsTagsEqual(o1, o2 *AnalyticsTagsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"AnalyticsTagsEqual",
"(",
"o1",
",",
"o2",
"*",
"AnalyticsTagsOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // AnalyticsTagsEqual 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. | [
"AnalyticsTagsEqual",
"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_tags.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/opt/disable_typo_tolerance_on_words.go | DisableTypoToleranceOnWordsEqual | func DisableTypoToleranceOnWordsEqual(o1, o2 *DisableTypoToleranceOnWordsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func DisableTypoToleranceOnWordsEqual(o1, o2 *DisableTypoToleranceOnWordsOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"DisableTypoToleranceOnWordsEqual",
"(",
"o1",
",",
"o2",
"*",
"DisableTypoToleranceOnWordsOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // DisableTypoToleranceOnWordsEqual 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. | [
"DisableTypoToleranceOnWordsEqual",
"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/disable_typo_tolerance_on_words.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/query_type.go | ExtractQueryType | func ExtractQueryType(opts ...interface{}) *opt.QueryTypeOption {
for _, o := range opts {
if v, ok := o.(*opt.QueryTypeOption); ok {
return v
}
}
return nil
} | go | func ExtractQueryType(opts ...interface{}) *opt.QueryTypeOption {
for _, o := range opts {
if v, ok := o.(*opt.QueryTypeOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractQueryType",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"QueryTypeOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"QueryTypeOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractQueryType returns the first found QueryTypeOption from the
// given variadic arguments or nil otherwise. | [
"ExtractQueryType",
"returns",
"the",
"first",
"found",
"QueryTypeOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/query_type.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/exact_on_single_word_query.go | ExtractExactOnSingleWordQuery | func ExtractExactOnSingleWordQuery(opts ...interface{}) *opt.ExactOnSingleWordQueryOption {
for _, o := range opts {
if v, ok := o.(*opt.ExactOnSingleWordQueryOption); ok {
return v
}
}
return nil
} | go | func ExtractExactOnSingleWordQuery(opts ...interface{}) *opt.ExactOnSingleWordQueryOption {
for _, o := range opts {
if v, ok := o.(*opt.ExactOnSingleWordQueryOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractExactOnSingleWordQuery",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"ExactOnSingleWordQueryOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"ExactOnSingleWordQueryOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractExactOnSingleWordQuery returns the first found ExactOnSingleWordQueryOption from the
// given variadic arguments or nil otherwise. | [
"ExtractExactOnSingleWordQuery",
"returns",
"the",
"first",
"found",
"ExactOnSingleWordQueryOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/exact_on_single_word_query.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/cluster_name.go | ExtractClusterName | func ExtractClusterName(opts ...interface{}) *opt.ClusterNameOption {
for _, o := range opts {
if v, ok := o.(*opt.ClusterNameOption); ok {
return v
}
}
return nil
} | go | func ExtractClusterName(opts ...interface{}) *opt.ClusterNameOption {
for _, o := range opts {
if v, ok := o.(*opt.ClusterNameOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractClusterName",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"ClusterNameOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"ClusterNameOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractClusterName returns the first found ClusterNameOption from the
// given variadic arguments or nil otherwise. | [
"ExtractClusterName",
"returns",
"the",
"first",
"found",
"ClusterNameOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/cluster_name.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/opt/primary.go | PrimaryEqual | func PrimaryEqual(o1, o2 *PrimaryOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func PrimaryEqual(o1, o2 *PrimaryOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"PrimaryEqual",
"(",
"o1",
",",
"o2",
"*",
"PrimaryOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // PrimaryEqual 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. | [
"PrimaryEqual",
"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/primary.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/allow_compression_of_integer_array.go | AllowCompressionOfIntegerArrayEqual | func AllowCompressionOfIntegerArrayEqual(o1, o2 *AllowCompressionOfIntegerArrayOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func AllowCompressionOfIntegerArrayEqual(o1, o2 *AllowCompressionOfIntegerArrayOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"AllowCompressionOfIntegerArrayEqual",
"(",
"o1",
",",
"o2",
"*",
"AllowCompressionOfIntegerArrayOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // AllowCompressionOfIntegerArrayEqual 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. | [
"AllowCompressionOfIntegerArrayEqual",
"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/allow_compression_of_integer_array.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/percentile_computation.go | PercentileComputationEqual | func PercentileComputationEqual(o1, o2 *PercentileComputationOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func PercentileComputationEqual(o1, o2 *PercentileComputationOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"PercentileComputationEqual",
"(",
"o1",
",",
"o2",
"*",
"PercentileComputationOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // PercentileComputationEqual 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. | [
"PercentileComputationEqual",
"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/percentile_computation.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/exact_on_single_word_query.go | ExactOnSingleWordQueryEqual | func ExactOnSingleWordQueryEqual(o1, o2 *ExactOnSingleWordQueryOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func ExactOnSingleWordQueryEqual(o1, o2 *ExactOnSingleWordQueryOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"ExactOnSingleWordQueryEqual",
"(",
"o1",
",",
"o2",
"*",
"ExactOnSingleWordQueryOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // ExactOnSingleWordQueryEqual 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. | [
"ExactOnSingleWordQueryEqual",
"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/exact_on_single_word_query.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/search/index_rules.go | GetRule | func (i *Index) GetRule(objectID string, opts ...interface{}) (rule Rule, err error) {
if objectID == "" {
err = errs.ErrMissingObjectID
return
}
path := i.path("/rules/%s", url.QueryEscape(objectID))
err = i.transport.Request(&rule, http.MethodGet, path, nil, call.Read, opts...)
return
} | go | func (i *Index) GetRule(objectID string, opts ...interface{}) (rule Rule, err error) {
if objectID == "" {
err = errs.ErrMissingObjectID
return
}
path := i.path("/rules/%s", url.QueryEscape(objectID))
err = i.transport.Request(&rule, http.MethodGet, path, nil, call.Read, opts...)
return
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"GetRule",
"(",
"objectID",
"string",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"rule",
"Rule",
",",
"err",
"error",
")",
"{",
"if",
"objectID",
"==",
"\"",
"\"",
"{",
"err",
"=",
"errs",
".",
"ErrMissingObjectID",
"\n",
"return",
"\n",
"}",
"\n\n",
"path",
":=",
"i",
".",
"path",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"objectID",
")",
")",
"\n",
"err",
"=",
"i",
".",
"transport",
".",
"Request",
"(",
"&",
"rule",
",",
"http",
".",
"MethodGet",
",",
"path",
",",
"nil",
",",
"call",
".",
"Read",
",",
"opts",
"...",
")",
"\n",
"return",
"\n",
"}"
] | // GetRule retrieves the rule identified by the given objectID. | [
"GetRule",
"retrieves",
"the",
"rule",
"identified",
"by",
"the",
"given",
"objectID",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_rules.go#L14-L23 | train |
algolia/algoliasearch-client-go | algolia/search/index_rules.go | SaveRule | func (i *Index) SaveRule(rule Rule, opts ...interface{}) (res UpdateTaskRes, err error) {
if rule.ObjectID == "" {
err = errs.ErrMissingObjectID
res.wait = noWait
return
}
path := i.path("/rules/%s", url.QueryEscape(rule.ObjectID))
err = i.transport.Request(&res, http.MethodPut, path, rule, call.Write, opts...)
res.wait = i.WaitTask
return
} | go | func (i *Index) SaveRule(rule Rule, opts ...interface{}) (res UpdateTaskRes, err error) {
if rule.ObjectID == "" {
err = errs.ErrMissingObjectID
res.wait = noWait
return
}
path := i.path("/rules/%s", url.QueryEscape(rule.ObjectID))
err = i.transport.Request(&res, http.MethodPut, path, rule, call.Write, opts...)
res.wait = i.WaitTask
return
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"SaveRule",
"(",
"rule",
"Rule",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"UpdateTaskRes",
",",
"err",
"error",
")",
"{",
"if",
"rule",
".",
"ObjectID",
"==",
"\"",
"\"",
"{",
"err",
"=",
"errs",
".",
"ErrMissingObjectID",
"\n",
"res",
".",
"wait",
"=",
"noWait",
"\n",
"return",
"\n",
"}",
"\n\n",
"path",
":=",
"i",
".",
"path",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"rule",
".",
"ObjectID",
")",
")",
"\n",
"err",
"=",
"i",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodPut",
",",
"path",
",",
"rule",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"i",
".",
"WaitTask",
"\n",
"return",
"\n",
"}"
] | // SaveRule saves the given rule. | [
"SaveRule",
"saves",
"the",
"given",
"rule",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_rules.go#L26-L37 | train |
algolia/algoliasearch-client-go | algolia/search/index_rules.go | SaveRules | func (i *Index) SaveRules(rules []Rule, opts ...interface{}) (res UpdateTaskRes, err error) {
if clearExistingRules := iopt.ExtractClearExistingRules(opts...); clearExistingRules != nil {
opts = opt.InsertExtraURLParam(opts, "clearExistingRules", clearExistingRules.Get())
}
path := i.path("/rules/batch")
err = i.transport.Request(&res, http.MethodPost, path, rules, call.Write, opts...)
res.wait = i.WaitTask
return
} | go | func (i *Index) SaveRules(rules []Rule, opts ...interface{}) (res UpdateTaskRes, err error) {
if clearExistingRules := iopt.ExtractClearExistingRules(opts...); clearExistingRules != nil {
opts = opt.InsertExtraURLParam(opts, "clearExistingRules", clearExistingRules.Get())
}
path := i.path("/rules/batch")
err = i.transport.Request(&res, http.MethodPost, path, rules, call.Write, opts...)
res.wait = i.WaitTask
return
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"SaveRules",
"(",
"rules",
"[",
"]",
"Rule",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"UpdateTaskRes",
",",
"err",
"error",
")",
"{",
"if",
"clearExistingRules",
":=",
"iopt",
".",
"ExtractClearExistingRules",
"(",
"opts",
"...",
")",
";",
"clearExistingRules",
"!=",
"nil",
"{",
"opts",
"=",
"opt",
".",
"InsertExtraURLParam",
"(",
"opts",
",",
"\"",
"\"",
",",
"clearExistingRules",
".",
"Get",
"(",
")",
")",
"\n",
"}",
"\n",
"path",
":=",
"i",
".",
"path",
"(",
"\"",
"\"",
")",
"\n",
"err",
"=",
"i",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodPost",
",",
"path",
",",
"rules",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"i",
".",
"WaitTask",
"\n",
"return",
"\n",
"}"
] | // SaveRule saves the given rules.
//
// Unlike SaveObjects, this method does not batch the given rules i.e. all rules
// are sent in a single call. | [
"SaveRule",
"saves",
"the",
"given",
"rules",
".",
"Unlike",
"SaveObjects",
"this",
"method",
"does",
"not",
"batch",
"the",
"given",
"rules",
"i",
".",
"e",
".",
"all",
"rules",
"are",
"sent",
"in",
"a",
"single",
"call",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_rules.go#L43-L51 | train |
algolia/algoliasearch-client-go | algolia/search/index_rules.go | DeleteRule | func (i *Index) DeleteRule(objectID string, opts ...interface{}) (res UpdateTaskRes, err error) {
if objectID == "" {
err = errs.ErrMissingObjectID
res.wait = noWait
return
}
path := i.path("/rules/%s", url.QueryEscape(objectID))
err = i.transport.Request(&res, http.MethodDelete, path, nil, call.Write, opts...)
res.wait = i.WaitTask
return
} | go | func (i *Index) DeleteRule(objectID string, opts ...interface{}) (res UpdateTaskRes, err error) {
if objectID == "" {
err = errs.ErrMissingObjectID
res.wait = noWait
return
}
path := i.path("/rules/%s", url.QueryEscape(objectID))
err = i.transport.Request(&res, http.MethodDelete, path, nil, call.Write, opts...)
res.wait = i.WaitTask
return
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"DeleteRule",
"(",
"objectID",
"string",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"res",
"UpdateTaskRes",
",",
"err",
"error",
")",
"{",
"if",
"objectID",
"==",
"\"",
"\"",
"{",
"err",
"=",
"errs",
".",
"ErrMissingObjectID",
"\n",
"res",
".",
"wait",
"=",
"noWait",
"\n",
"return",
"\n",
"}",
"\n\n",
"path",
":=",
"i",
".",
"path",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"objectID",
")",
")",
"\n",
"err",
"=",
"i",
".",
"transport",
".",
"Request",
"(",
"&",
"res",
",",
"http",
".",
"MethodDelete",
",",
"path",
",",
"nil",
",",
"call",
".",
"Write",
",",
"opts",
"...",
")",
"\n",
"res",
".",
"wait",
"=",
"i",
".",
"WaitTask",
"\n",
"return",
"\n",
"}"
] | // DeleteRule removes the rule identified by the given objectID. | [
"DeleteRule",
"removes",
"the",
"rule",
"identified",
"by",
"the",
"given",
"objectID",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_rules.go#L62-L73 | train |
algolia/algoliasearch-client-go | algolia/search/index_rules.go | ReplaceAllRules | func (i *Index) ReplaceAllRules(rules []Rule, opts ...interface{}) (UpdateTaskRes, error) {
opts = opt.InsertOrReplaceOption(opts, opt.ClearExistingRules(true))
return i.SaveRules(rules, opts...)
} | go | func (i *Index) ReplaceAllRules(rules []Rule, opts ...interface{}) (UpdateTaskRes, error) {
opts = opt.InsertOrReplaceOption(opts, opt.ClearExistingRules(true))
return i.SaveRules(rules, opts...)
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"ReplaceAllRules",
"(",
"rules",
"[",
"]",
"Rule",
",",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"UpdateTaskRes",
",",
"error",
")",
"{",
"opts",
"=",
"opt",
".",
"InsertOrReplaceOption",
"(",
"opts",
",",
"opt",
".",
"ClearExistingRules",
"(",
"true",
")",
")",
"\n",
"return",
"i",
".",
"SaveRules",
"(",
"rules",
",",
"opts",
"...",
")",
"\n",
"}"
] | // ReplaceAllRules replaces any existing rules with the given ones. | [
"ReplaceAllRules",
"replaces",
"any",
"existing",
"rules",
"with",
"the",
"given",
"ones",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_rules.go#L86-L89 | train |
algolia/algoliasearch-client-go | algolia/search/index_rules.go | BrowseRules | func (i *Index) BrowseRules(opts ...interface{}) (*RuleIterator, error) {
browser := func(page int) (SearchRulesRes, error) {
opts = opt.InsertOrReplaceOption(opts, opt.Page(page))
return i.SearchRules("", opts...)
}
return newRuleIterator(browser)
} | go | func (i *Index) BrowseRules(opts ...interface{}) (*RuleIterator, error) {
browser := func(page int) (SearchRulesRes, error) {
opts = opt.InsertOrReplaceOption(opts, opt.Page(page))
return i.SearchRules("", opts...)
}
return newRuleIterator(browser)
} | [
"func",
"(",
"i",
"*",
"Index",
")",
"BrowseRules",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"(",
"*",
"RuleIterator",
",",
"error",
")",
"{",
"browser",
":=",
"func",
"(",
"page",
"int",
")",
"(",
"SearchRulesRes",
",",
"error",
")",
"{",
"opts",
"=",
"opt",
".",
"InsertOrReplaceOption",
"(",
"opts",
",",
"opt",
".",
"Page",
"(",
"page",
")",
")",
"\n",
"return",
"i",
".",
"SearchRules",
"(",
"\"",
"\"",
",",
"opts",
"...",
")",
"\n",
"}",
"\n",
"return",
"newRuleIterator",
"(",
"browser",
")",
"\n",
"}"
] | // BrowseRules returns an iterator which will retrieve rules one by one from the
// index. | [
"BrowseRules",
"returns",
"an",
"iterator",
"which",
"will",
"retrieve",
"rules",
"one",
"by",
"one",
"from",
"the",
"index",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/index_rules.go#L93-L99 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/type.go | ExtractType | func ExtractType(opts ...interface{}) *opt.TypeOption {
for _, o := range opts {
if v, ok := o.(*opt.TypeOption); ok {
return v
}
}
return nil
} | go | func ExtractType(opts ...interface{}) *opt.TypeOption {
for _, o := range opts {
if v, ok := o.(*opt.TypeOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractType",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"TypeOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"TypeOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractType returns the first found TypeOption from the
// given variadic arguments or nil otherwise. | [
"ExtractType",
"returns",
"the",
"first",
"found",
"TypeOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/type.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/internal/opt/distinct.go | ExtractDistinct | func ExtractDistinct(opts ...interface{}) *opt.DistinctOption {
for _, o := range opts {
if v, ok := o.(*opt.DistinctOption); ok {
return v
}
}
return nil
} | go | func ExtractDistinct(opts ...interface{}) *opt.DistinctOption {
for _, o := range opts {
if v, ok := o.(*opt.DistinctOption); ok {
return v
}
}
return nil
} | [
"func",
"ExtractDistinct",
"(",
"opts",
"...",
"interface",
"{",
"}",
")",
"*",
"opt",
".",
"DistinctOption",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"if",
"v",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"opt",
".",
"DistinctOption",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // ExtractDistinct returns the first found DistinctOption from the
// given variadic arguments or nil otherwise. | [
"ExtractDistinct",
"returns",
"the",
"first",
"found",
"DistinctOption",
"from",
"the",
"given",
"variadic",
"arguments",
"or",
"nil",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/internal/opt/distinct.go#L11-L18 | train |
algolia/algoliasearch-client-go | algolia/search/rule.go | Equal | func (r Rule) Equal(r2 Rule) bool {
if !(r.ObjectID == r2.ObjectID &&
r.Description == r2.Description &&
r.Enabled == r2.Enabled &&
len(r.Validity) == len(r2.Validity) &&
reflect.DeepEqual(r.Condition, r2.Condition) &&
reflect.DeepEqual(r.Consequence, r2.Consequence)) {
return false
}
for i, r := range r.Validity {
if !r.Equal(r2.Validity[i]) {
return false
}
}
return true
} | go | func (r Rule) Equal(r2 Rule) bool {
if !(r.ObjectID == r2.ObjectID &&
r.Description == r2.Description &&
r.Enabled == r2.Enabled &&
len(r.Validity) == len(r2.Validity) &&
reflect.DeepEqual(r.Condition, r2.Condition) &&
reflect.DeepEqual(r.Consequence, r2.Consequence)) {
return false
}
for i, r := range r.Validity {
if !r.Equal(r2.Validity[i]) {
return false
}
}
return true
} | [
"func",
"(",
"r",
"Rule",
")",
"Equal",
"(",
"r2",
"Rule",
")",
"bool",
"{",
"if",
"!",
"(",
"r",
".",
"ObjectID",
"==",
"r2",
".",
"ObjectID",
"&&",
"r",
".",
"Description",
"==",
"r2",
".",
"Description",
"&&",
"r",
".",
"Enabled",
"==",
"r2",
".",
"Enabled",
"&&",
"len",
"(",
"r",
".",
"Validity",
")",
"==",
"len",
"(",
"r2",
".",
"Validity",
")",
"&&",
"reflect",
".",
"DeepEqual",
"(",
"r",
".",
"Condition",
",",
"r2",
".",
"Condition",
")",
"&&",
"reflect",
".",
"DeepEqual",
"(",
"r",
".",
"Consequence",
",",
"r2",
".",
"Consequence",
")",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"r",
":=",
"range",
"r",
".",
"Validity",
"{",
"if",
"!",
"r",
".",
"Equal",
"(",
"r2",
".",
"Validity",
"[",
"i",
"]",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] | // Equal returns true if the Rules are equal. It returns false otherwise. | [
"Equal",
"returns",
"true",
"if",
"the",
"Rules",
"are",
"equal",
".",
"It",
"returns",
"false",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/rule.go#L48-L65 | train |
algolia/algoliasearch-client-go | algolia/search/rule.go | Equal | func (r TimeRange) Equal(r2 TimeRange) bool {
return r.From.Equal(r2.From) && r.Until.Equal(r2.Until)
} | go | func (r TimeRange) Equal(r2 TimeRange) bool {
return r.From.Equal(r2.From) && r.Until.Equal(r2.Until)
} | [
"func",
"(",
"r",
"TimeRange",
")",
"Equal",
"(",
"r2",
"TimeRange",
")",
"bool",
"{",
"return",
"r",
".",
"From",
".",
"Equal",
"(",
"r2",
".",
"From",
")",
"&&",
"r",
".",
"Until",
".",
"Equal",
"(",
"r2",
".",
"Until",
")",
"\n",
"}"
] | // Equal returns true if the TimeRanges are equal. It returns false otherwise. | [
"Equal",
"returns",
"true",
"if",
"the",
"TimeRanges",
"are",
"equal",
".",
"It",
"returns",
"false",
"otherwise",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/search/rule.go#L68-L70 | train |
algolia/algoliasearch-client-go | algolia/opt/disable_exact_on_attributes.go | DisableExactOnAttributesEqual | func DisableExactOnAttributesEqual(o1, o2 *DisableExactOnAttributesOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func DisableExactOnAttributesEqual(o1, o2 *DisableExactOnAttributesOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"DisableExactOnAttributesEqual",
"(",
"o1",
",",
"o2",
"*",
"DisableExactOnAttributesOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // DisableExactOnAttributesEqual 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. | [
"DisableExactOnAttributesEqual",
"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/disable_exact_on_attributes.go#L58-L66 | train |
algolia/algoliasearch-client-go | algolia/opt/optional_filters.go | OptionalFiltersEqual | func OptionalFiltersEqual(o1, o2 *OptionalFiltersOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func OptionalFiltersEqual(o1, o2 *OptionalFiltersOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"OptionalFiltersEqual",
"(",
"o1",
",",
"o2",
"*",
"OptionalFiltersOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // OptionalFiltersEqual 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. | [
"OptionalFiltersEqual",
"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/optional_filters.go#L66-L74 | train |
algolia/algoliasearch-client-go | algolia/opt/forward_to_replicas.go | ForwardToReplicasEqual | func ForwardToReplicasEqual(o1, o2 *ForwardToReplicasOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func ForwardToReplicasEqual(o1, o2 *ForwardToReplicasOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"ForwardToReplicasEqual",
"(",
"o1",
",",
"o2",
"*",
"ForwardToReplicasOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // ForwardToReplicasEqual 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. | [
"ForwardToReplicasEqual",
"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/forward_to_replicas.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/limit.go | LimitEqual | func LimitEqual(o1, o2 *LimitOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func LimitEqual(o1, o2 *LimitOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"LimitEqual",
"(",
"o1",
",",
"o2",
"*",
"LimitOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // LimitEqual 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. | [
"LimitEqual",
"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/limit.go#L55-L63 | train |
algolia/algoliasearch-client-go | algolia/opt/typo_tolerance.go | UnmarshalJSON | func (o *TypoToleranceOption) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
o.value = typoToleranceTrue
return nil
}
var v string
if err := json.Unmarshal(data, &v); err == nil {
o.value = v
return nil
}
var b bool
if err := json.Unmarshal(data, &b); err == nil {
o.value = fmt.Sprintf("%t", b)
return nil
}
return errs.ErrJSONDecode(data, "TypoTolerance")
} | go | func (o *TypoToleranceOption) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
o.value = typoToleranceTrue
return nil
}
var v string
if err := json.Unmarshal(data, &v); err == nil {
o.value = v
return nil
}
var b bool
if err := json.Unmarshal(data, &b); err == nil {
o.value = fmt.Sprintf("%t", b)
return nil
}
return errs.ErrJSONDecode(data, "TypoTolerance")
} | [
"func",
"(",
"o",
"*",
"TypoToleranceOption",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"string",
"(",
"data",
")",
"==",
"\"",
"\"",
"{",
"o",
".",
"value",
"=",
"typoToleranceTrue",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"v",
"string",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"v",
")",
";",
"err",
"==",
"nil",
"{",
"o",
".",
"value",
"=",
"v",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"b",
"bool",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"b",
")",
";",
"err",
"==",
"nil",
"{",
"o",
".",
"value",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"b",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"errs",
".",
"ErrJSONDecode",
"(",
"data",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // UnmarshalJSON implements the json.Unmarshaler interface for
// TypoToleranceOption. | [
"UnmarshalJSON",
"implements",
"the",
"json",
".",
"Unmarshaler",
"interface",
"for",
"TypoToleranceOption",
"."
] | dc059c0414d8c06e2b2bb47412b2130799bfcc9f | https://github.com/algolia/algoliasearch-client-go/blob/dc059c0414d8c06e2b2bb47412b2130799bfcc9f/algolia/opt/typo_tolerance.go#L62-L81 | train |
algolia/algoliasearch-client-go | algolia/opt/typo_tolerance.go | TypoToleranceEqual | func TypoToleranceEqual(o1, o2 *TypoToleranceOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | go | func TypoToleranceEqual(o1, o2 *TypoToleranceOption) bool {
if o1 != nil {
return o1.Equal(o2)
}
if o2 != nil {
return o2.Equal(o1)
}
return true
} | [
"func",
"TypoToleranceEqual",
"(",
"o1",
",",
"o2",
"*",
"TypoToleranceOption",
")",
"bool",
"{",
"if",
"o1",
"!=",
"nil",
"{",
"return",
"o1",
".",
"Equal",
"(",
"o2",
")",
"\n",
"}",
"\n",
"if",
"o2",
"!=",
"nil",
"{",
"return",
"o2",
".",
"Equal",
"(",
"o1",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // TypoToleranceEqual 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. | [
"TypoToleranceEqual",
"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/typo_tolerance.go#L96-L104 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.