id int32 0 167k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
138,900 | xuyu/goredis | scripting.go | ScriptLoad | func (r *Redis) ScriptLoad(script string) (string, error) {
rp, err := r.ExecuteCommand("SCRIPT", "LOAD", script)
if err != nil {
return "", err
}
return rp.StringValue()
} | go | func (r *Redis) ScriptLoad(script string) (string, error) {
rp, err := r.ExecuteCommand("SCRIPT", "LOAD", script)
if err != nil {
return "", err
}
return rp.StringValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"ScriptLoad",
"(",
"script",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"script",
")",
"\n",
"if",
"err",
... | // ScriptLoad Load a script into the scripts cache, without executing it.
// After the specified command is loaded into the script cache
// it will be callable using EVALSHA with the correct SHA1 digest of the script,
// exactly like after the first successful invocation of EVAL.
// Bulk reply This command returns the ... | [
"ScriptLoad",
"Load",
"a",
"script",
"into",
"the",
"scripts",
"cache",
"without",
"executing",
"it",
".",
"After",
"the",
"specified",
"command",
"is",
"loaded",
"into",
"the",
"script",
"cache",
"it",
"will",
"be",
"callable",
"using",
"EVALSHA",
"with",
"... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/scripting.go#L41-L47 |
138,901 | xuyu/goredis | scripting.go | EvalSha | func (r *Redis) EvalSha(sha1 string, keys []string, args []string) (*Reply, error) {
cmds := packArgs("EVALSHA", sha1, len(keys), keys, args)
return r.ExecuteCommand(cmds...)
} | go | func (r *Redis) EvalSha(sha1 string, keys []string, args []string) (*Reply, error) {
cmds := packArgs("EVALSHA", sha1, len(keys), keys, args)
return r.ExecuteCommand(cmds...)
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"EvalSha",
"(",
"sha1",
"string",
",",
"keys",
"[",
"]",
"string",
",",
"args",
"[",
"]",
"string",
")",
"(",
"*",
"Reply",
",",
"error",
")",
"{",
"cmds",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"sha1",
","... | // EvalSha evaluates a script cached on the server side by its SHA1 digest.
// Scripts are cached on the server side using the SCRIPT LOAD command. | [
"EvalSha",
"evaluates",
"a",
"script",
"cached",
"on",
"the",
"server",
"side",
"by",
"its",
"SHA1",
"digest",
".",
"Scripts",
"are",
"cached",
"on",
"the",
"server",
"side",
"using",
"the",
"SCRIPT",
"LOAD",
"command",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/scripting.go#L63-L66 |
138,902 | xuyu/goredis | pipelining.go | Close | func (p *Pipelined) Close() {
p.redis.pool.Put(p.conn)
p.times = 0
} | go | func (p *Pipelined) Close() {
p.redis.pool.Put(p.conn)
p.times = 0
} | [
"func",
"(",
"p",
"*",
"Pipelined",
")",
"Close",
"(",
")",
"{",
"p",
".",
"redis",
".",
"pool",
".",
"Put",
"(",
"p",
".",
"conn",
")",
"\n",
"p",
".",
"times",
"=",
"0",
"\n",
"}"
] | // Close closes current pipeline mode. | [
"Close",
"closes",
"current",
"pipeline",
"mode",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/pipelining.go#L24-L27 |
138,903 | xuyu/goredis | pipelining.go | Command | func (p *Pipelined) Command(args ...interface{}) error {
err := p.conn.SendCommand(args...)
if err == nil {
p.times++
}
return err
} | go | func (p *Pipelined) Command(args ...interface{}) error {
err := p.conn.SendCommand(args...)
if err == nil {
p.times++
}
return err
} | [
"func",
"(",
"p",
"*",
"Pipelined",
")",
"Command",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"err",
":=",
"p",
".",
"conn",
".",
"SendCommand",
"(",
"args",
"...",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"p",
".",
"times",
... | // Command send raw redis command and do not wait for response. | [
"Command",
"send",
"raw",
"redis",
"command",
"and",
"do",
"not",
"wait",
"for",
"response",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/pipelining.go#L30-L36 |
138,904 | xuyu/goredis | pipelining.go | Receive | func (p *Pipelined) Receive() (*Reply, error) {
rp, err := p.conn.RecvReply()
if err == nil {
p.times--
}
return rp, err
} | go | func (p *Pipelined) Receive() (*Reply, error) {
rp, err := p.conn.RecvReply()
if err == nil {
p.times--
}
return rp, err
} | [
"func",
"(",
"p",
"*",
"Pipelined",
")",
"Receive",
"(",
")",
"(",
"*",
"Reply",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"p",
".",
"conn",
".",
"RecvReply",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"p",
".",
"times",
"--",
"\n",... | // Receive wait for one the response. | [
"Receive",
"wait",
"for",
"one",
"the",
"response",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/pipelining.go#L39-L45 |
138,905 | xuyu/goredis | pipelining.go | ReceiveAll | func (p *Pipelined) ReceiveAll() ([]*Reply, error) {
if p.times <= 0 {
return nil, nil
}
rps := make([]*Reply, p.times)
num := p.times
for i := 0; i < num; i++ {
rp, err := p.Receive()
if err != nil {
return rps, err
}
rps[i] = rp
}
return rps, nil
} | go | func (p *Pipelined) ReceiveAll() ([]*Reply, error) {
if p.times <= 0 {
return nil, nil
}
rps := make([]*Reply, p.times)
num := p.times
for i := 0; i < num; i++ {
rp, err := p.Receive()
if err != nil {
return rps, err
}
rps[i] = rp
}
return rps, nil
} | [
"func",
"(",
"p",
"*",
"Pipelined",
")",
"ReceiveAll",
"(",
")",
"(",
"[",
"]",
"*",
"Reply",
",",
"error",
")",
"{",
"if",
"p",
".",
"times",
"<=",
"0",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"rps",
":=",
"make",
"(",
"[",
"]",
... | // ReceiveAll wait for all the responses before. | [
"ReceiveAll",
"wait",
"for",
"all",
"the",
"responses",
"before",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/pipelining.go#L48-L62 |
138,906 | xuyu/goredis | sets.go | SMembers | func (r *Redis) SMembers(key string) ([]string, error) {
rp, err := r.ExecuteCommand("SMEMBERS", key)
if err != nil {
return nil, err
}
return rp.ListValue()
} | go | func (r *Redis) SMembers(key string) ([]string, error) {
rp, err := r.ExecuteCommand("SMEMBERS", key)
if err != nil {
return nil, err
}
return rp.ListValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"SMembers",
"(",
"key",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // SMembers returns all the members of the set value stored at key. | [
"SMembers",
"returns",
"all",
"the",
"members",
"of",
"the",
"set",
"value",
"stored",
"at",
"key",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sets.go#L92-L98 |
138,907 | xuyu/goredis | sets.go | SMove | func (r *Redis) SMove(source, destination, member string) (bool, error) {
rp, err := r.ExecuteCommand("SMOVE", source, destination, member)
if err != nil {
return false, err
}
return rp.BoolValue()
} | go | func (r *Redis) SMove(source, destination, member string) (bool, error) {
rp, err := r.ExecuteCommand("SMOVE", source, destination, member)
if err != nil {
return false, err
}
return rp.BoolValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"SMove",
"(",
"source",
",",
"destination",
",",
"member",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"source",
",",
"destinatio... | // SMove moves member from the set at source to the set at destination.
// This operation is atomic.
// In every given moment the element will appear to be a member of source or destination for other clients. | [
"SMove",
"moves",
"member",
"from",
"the",
"set",
"at",
"source",
"to",
"the",
"set",
"at",
"destination",
".",
"This",
"operation",
"is",
"atomic",
".",
"In",
"every",
"given",
"moment",
"the",
"element",
"will",
"appear",
"to",
"be",
"a",
"member",
"of... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sets.go#L103-L109 |
138,908 | xuyu/goredis | sets.go | SRandMemberCount | func (r *Redis) SRandMemberCount(key string, count int) ([]string, error) {
rp, err := r.ExecuteCommand("SRANDMEMBER", key, count)
if err != nil {
return nil, err
}
return rp.ListValue()
} | go | func (r *Redis) SRandMemberCount(key string, count int) ([]string, error) {
rp, err := r.ExecuteCommand("SRANDMEMBER", key, count)
if err != nil {
return nil, err
}
return rp.ListValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"SRandMemberCount",
"(",
"key",
"string",
",",
"count",
"int",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"count... | // SRandMemberCount returns an array of count distinct elements if count is positive.
// If called with a negative count the behavior changes and the command
// is allowed to return the same element multiple times.
// In this case the numer of returned elements is the absolute value of the specified count.
// returns a... | [
"SRandMemberCount",
"returns",
"an",
"array",
"of",
"count",
"distinct",
"elements",
"if",
"count",
"is",
"positive",
".",
"If",
"called",
"with",
"a",
"negative",
"count",
"the",
"behavior",
"changes",
"and",
"the",
"command",
"is",
"allowed",
"to",
"return",... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sets.go#L137-L143 |
138,909 | xuyu/goredis | sorted_sets.go | ZRemRangeByLex | func (r *Redis) ZRemRangeByLex(key, min, max string) (int64, error) {
rp, err := r.ExecuteCommand("ZREMRANGEBYLEX", key, min, max)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | go | func (r *Redis) ZRemRangeByLex(key, min, max string) (int64, error) {
rp, err := r.ExecuteCommand("ZREMRANGEBYLEX", key, min, max)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"ZRemRangeByLex",
"(",
"key",
",",
"min",
",",
"max",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"min",
",",
"m... | // ZRemRangeByLex removes all elements in the sorted set stored at key
// between the lexicographical range specified by min and max. | [
"ZRemRangeByLex",
"removes",
"all",
"elements",
"in",
"the",
"sorted",
"set",
"stored",
"at",
"key",
"between",
"the",
"lexicographical",
"range",
"specified",
"by",
"min",
"and",
"max",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sorted_sets.go#L190-L196 |
138,910 | xuyu/goredis | strings.go | DecrBy | func (r *Redis) DecrBy(key string, decrement int) (int64, error) {
rp, err := r.ExecuteCommand("DECRBY", key, decrement)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | go | func (r *Redis) DecrBy(key string, decrement int) (int64, error) {
rp, err := r.ExecuteCommand("DECRBY", key, decrement)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"DecrBy",
"(",
"key",
"string",
",",
"decrement",
"int",
")",
"(",
"int64",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"decrement",
")",
"\n",... | // DecrBy decrements the number stored at key by decrement. | [
"DecrBy",
"decrements",
"the",
"number",
"stored",
"at",
"key",
"by",
"decrement",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/strings.go#L61-L67 |
138,911 | xuyu/goredis | strings.go | GetSet | func (r *Redis) GetSet(key, value string) ([]byte, error) {
rp, err := r.ExecuteCommand("GETSET", key, value)
if err != nil {
return nil, err
}
return rp.BytesValue()
} | go | func (r *Redis) GetSet(key, value string) ([]byte, error) {
rp, err := r.ExecuteCommand("GETSET", key, value)
if err != nil {
return nil, err
}
return rp.BytesValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"GetSet",
"(",
"key",
",",
"value",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"value",
")",
"\n",
"... | // GetSet atomically sets key to value and returns the old value stored at key.
// Returns an error when key exists but does not hold a string value. | [
"GetSet",
"atomically",
"sets",
"key",
"to",
"value",
"and",
"returns",
"the",
"old",
"value",
"stored",
"at",
"key",
".",
"Returns",
"an",
"error",
"when",
"key",
"exists",
"but",
"does",
"not",
"hold",
"a",
"string",
"value",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/strings.go#L109-L115 |
138,912 | xuyu/goredis | strings.go | MSet | func (r *Redis) MSet(pairs map[string]string) error {
args := packArgs("MSET", pairs)
_, err := r.ExecuteCommand(args...)
return err
} | go | func (r *Redis) MSet(pairs map[string]string) error {
args := packArgs("MSET", pairs)
_, err := r.ExecuteCommand(args...)
return err
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"MSet",
"(",
"pairs",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"args",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"pairs",
")",
"\n",
"_",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"args",... | // MSet sets the given keys to their respective values.
// MSET replaces existing values with new values, just as regular SET.
// See MSETNX if you don't want to overwrite existing values. | [
"MSet",
"sets",
"the",
"given",
"keys",
"to",
"their",
"respective",
"values",
".",
"MSET",
"replaces",
"existing",
"values",
"with",
"new",
"values",
"just",
"as",
"regular",
"SET",
".",
"See",
"MSETNX",
"if",
"you",
"don",
"t",
"want",
"to",
"overwrite",... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/strings.go#L179-L183 |
138,913 | xuyu/goredis | strings.go | PSetex | func (r *Redis) PSetex(key string, milliseconds int, value string) error {
_, err := r.ExecuteCommand("PSETEX", key, milliseconds, value)
return err
} | go | func (r *Redis) PSetex(key string, milliseconds int, value string) error {
_, err := r.ExecuteCommand("PSETEX", key, milliseconds, value)
return err
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"PSetex",
"(",
"key",
"string",
",",
"milliseconds",
"int",
",",
"value",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"milliseconds",
",",
"v... | // PSetex works exactly like SETEX with the sole difference that
// the expire time is specified in milliseconds instead of seconds. | [
"PSetex",
"works",
"exactly",
"like",
"SETEX",
"with",
"the",
"sole",
"difference",
"that",
"the",
"expire",
"time",
"is",
"specified",
"in",
"milliseconds",
"instead",
"of",
"seconds",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/strings.go#L200-L203 |
138,914 | xuyu/goredis | strings.go | Set | func (r *Redis) Set(key, value string, seconds, milliseconds int, mustExists, mustNotExists bool) error {
args := packArgs("SET", key, value)
if seconds > 0 {
args = append(args, "EX", seconds)
}
if milliseconds > 0 {
args = append(args, "PX", milliseconds)
}
if mustExists {
args = append(args, "XX")
} els... | go | func (r *Redis) Set(key, value string, seconds, milliseconds int, mustExists, mustNotExists bool) error {
args := packArgs("SET", key, value)
if seconds > 0 {
args = append(args, "EX", seconds)
}
if milliseconds > 0 {
args = append(args, "PX", milliseconds)
}
if mustExists {
args = append(args, "XX")
} els... | [
"func",
"(",
"r",
"*",
"Redis",
")",
"Set",
"(",
"key",
",",
"value",
"string",
",",
"seconds",
",",
"milliseconds",
"int",
",",
"mustExists",
",",
"mustNotExists",
"bool",
")",
"error",
"{",
"args",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"key",
","... | // Set sets key to hold the string value.
// If key already holds a value, it is overwritten, regardless of its type.
// Any previous time to live associated with the key is discarded on successful SET operation. | [
"Set",
"sets",
"key",
"to",
"hold",
"the",
"string",
"value",
".",
"If",
"key",
"already",
"holds",
"a",
"value",
"it",
"is",
"overwritten",
"regardless",
"of",
"its",
"type",
".",
"Any",
"previous",
"time",
"to",
"live",
"associated",
"with",
"the",
"ke... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/strings.go#L208-L226 |
138,915 | xuyu/goredis | strings.go | SimpleSet | func (r *Redis) SimpleSet(key, value string) error {
return r.Set(key, value, 0, 0, false, false)
} | go | func (r *Redis) SimpleSet(key, value string) error {
return r.Set(key, value, 0, 0, false, false)
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"SimpleSet",
"(",
"key",
",",
"value",
"string",
")",
"error",
"{",
"return",
"r",
".",
"Set",
"(",
"key",
",",
"value",
",",
"0",
",",
"0",
",",
"false",
",",
"false",
")",
"\n",
"}"
] | // SimpleSet do SET key value, no other arguments. | [
"SimpleSet",
"do",
"SET",
"key",
"value",
"no",
"other",
"arguments",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/strings.go#L229-L231 |
138,916 | xuyu/goredis | strings.go | Setex | func (r *Redis) Setex(key string, seconds int, value string) error {
rp, err := r.ExecuteCommand("SETEX", key, seconds, value)
if err != nil {
return err
}
return rp.OKValue()
} | go | func (r *Redis) Setex(key string, seconds int, value string) error {
rp, err := r.ExecuteCommand("SETEX", key, seconds, value)
if err != nil {
return err
}
return rp.OKValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"Setex",
"(",
"key",
"string",
",",
"seconds",
"int",
",",
"value",
"string",
")",
"error",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"seconds",
",",
"value",
"... | // Setex sets key to hold the string value and set key to timeout after a given number of seconds. | [
"Setex",
"sets",
"key",
"to",
"hold",
"the",
"string",
"value",
"and",
"set",
"key",
"to",
"timeout",
"after",
"a",
"given",
"number",
"of",
"seconds",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/strings.go#L244-L250 |
138,917 | xuyu/goredis | sort.go | By | func (s *SortCommand) By(pattern string) *SortCommand {
s.by = pattern
return s
} | go | func (s *SortCommand) By(pattern string) *SortCommand {
s.by = pattern
return s
} | [
"func",
"(",
"s",
"*",
"SortCommand",
")",
"By",
"(",
"pattern",
"string",
")",
"*",
"SortCommand",
"{",
"s",
".",
"by",
"=",
"pattern",
"\n",
"return",
"s",
"\n",
"}"
] | // By can also take a non-existent key, which causes SORT to skip the sorting operation. | [
"By",
"can",
"also",
"take",
"a",
"non",
"-",
"existent",
"key",
"which",
"causes",
"SORT",
"to",
"skip",
"the",
"sorting",
"operation",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sort.go#L24-L27 |
138,918 | xuyu/goredis | sort.go | Limit | func (s *SortCommand) Limit(offset, count int) *SortCommand {
s.limit = true
s.offset = offset
s.count = count
return s
} | go | func (s *SortCommand) Limit(offset, count int) *SortCommand {
s.limit = true
s.offset = offset
s.count = count
return s
} | [
"func",
"(",
"s",
"*",
"SortCommand",
")",
"Limit",
"(",
"offset",
",",
"count",
"int",
")",
"*",
"SortCommand",
"{",
"s",
".",
"limit",
"=",
"true",
"\n",
"s",
".",
"offset",
"=",
"offset",
"\n",
"s",
".",
"count",
"=",
"count",
"\n",
"return",
... | // Limit takes the offset and count argument,
// specifying the number of elements to skip and the count argument,
// specifying the number of elements to return from starting at offset. | [
"Limit",
"takes",
"the",
"offset",
"and",
"count",
"argument",
"specifying",
"the",
"number",
"of",
"elements",
"to",
"skip",
"and",
"the",
"count",
"argument",
"specifying",
"the",
"number",
"of",
"elements",
"to",
"return",
"from",
"starting",
"at",
"offset"... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sort.go#L32-L37 |
138,919 | xuyu/goredis | sort.go | Get | func (s *SortCommand) Get(patterns ...string) *SortCommand {
s.get = patterns
return s
} | go | func (s *SortCommand) Get(patterns ...string) *SortCommand {
s.get = patterns
return s
} | [
"func",
"(",
"s",
"*",
"SortCommand",
")",
"Get",
"(",
"patterns",
"...",
"string",
")",
"*",
"SortCommand",
"{",
"s",
".",
"get",
"=",
"patterns",
"\n",
"return",
"s",
"\n",
"}"
] | // Get sets sort GET arguments. | [
"Get",
"sets",
"sort",
"GET",
"arguments",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sort.go#L40-L43 |
138,920 | xuyu/goredis | sort.go | Alpha | func (s *SortCommand) Alpha(b bool) *SortCommand {
s.alpha = b
return s
} | go | func (s *SortCommand) Alpha(b bool) *SortCommand {
s.alpha = b
return s
} | [
"func",
"(",
"s",
"*",
"SortCommand",
")",
"Alpha",
"(",
"b",
"bool",
")",
"*",
"SortCommand",
"{",
"s",
".",
"alpha",
"=",
"b",
"\n",
"return",
"s",
"\n",
"}"
] | // Alpha sets ALPHA to sort command. | [
"Alpha",
"sets",
"ALPHA",
"to",
"sort",
"command",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sort.go#L58-L61 |
138,921 | xuyu/goredis | sort.go | Store | func (s *SortCommand) Store(destination string) *SortCommand {
s.store = destination
return s
} | go | func (s *SortCommand) Store(destination string) *SortCommand {
s.store = destination
return s
} | [
"func",
"(",
"s",
"*",
"SortCommand",
")",
"Store",
"(",
"destination",
"string",
")",
"*",
"SortCommand",
"{",
"s",
".",
"store",
"=",
"destination",
"\n",
"return",
"s",
"\n",
"}"
] | // Store sets the sorted result store to. | [
"Store",
"sets",
"the",
"sorted",
"result",
"store",
"to",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sort.go#L64-L67 |
138,922 | xuyu/goredis | sort.go | Run | func (s *SortCommand) Run() (*Reply, error) {
args := packArgs("SORT", s.key)
if s.by != "" {
args = append(args, "BY", s.by)
}
if s.limit {
args = append(args, "LIMIT", s.offset, s.count)
}
if s.get != nil && len(s.get) > 0 {
for _, pattern := range s.get {
args = append(args, "GET", pattern)
}
}
if... | go | func (s *SortCommand) Run() (*Reply, error) {
args := packArgs("SORT", s.key)
if s.by != "" {
args = append(args, "BY", s.by)
}
if s.limit {
args = append(args, "LIMIT", s.offset, s.count)
}
if s.get != nil && len(s.get) > 0 {
for _, pattern := range s.get {
args = append(args, "GET", pattern)
}
}
if... | [
"func",
"(",
"s",
"*",
"SortCommand",
")",
"Run",
"(",
")",
"(",
"*",
"Reply",
",",
"error",
")",
"{",
"args",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"s",
".",
"key",
")",
"\n",
"if",
"s",
".",
"by",
"!=",
"\"",
"\"",
"{",
"args",
"=",
"ap... | // Run performs redis sort command. | [
"Run",
"performs",
"redis",
"sort",
"command",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/sort.go#L70-L93 |
138,923 | xuyu/goredis | redis.go | ExecuteCommand | func (r *Redis) ExecuteCommand(args ...interface{}) (*Reply, error) {
c, err := r.pool.Get()
if err != nil {
return nil, err
}
if err := c.SendCommand(args...); err != nil {
if err != io.EOF {
return nil, err
}
c, err = r.pool.Get()
if err != nil {
return nil, err
}
if err = c.SendCommand(args..... | go | func (r *Redis) ExecuteCommand(args ...interface{}) (*Reply, error) {
c, err := r.pool.Get()
if err != nil {
return nil, err
}
if err := c.SendCommand(args...); err != nil {
if err != io.EOF {
return nil, err
}
c, err = r.pool.Get()
if err != nil {
return nil, err
}
if err = c.SendCommand(args..... | [
"func",
"(",
"r",
"*",
"Redis",
")",
"ExecuteCommand",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"(",
"*",
"Reply",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"r",
".",
"pool",
".",
"Get",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"... | // ExecuteCommand send any raw redis command and receive reply from redis server | [
"ExecuteCommand",
"send",
"any",
"raw",
"redis",
"command",
"and",
"receive",
"reply",
"from",
"redis",
"server"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L329-L364 |
138,924 | xuyu/goredis | redis.go | Dial | func Dial(cfg *DialConfig) (*Redis, error) {
if cfg == nil {
cfg = &DialConfig{}
}
if cfg.Network == "" {
cfg.Network = DefaultNetwork
}
if cfg.Address == "" {
cfg.Address = DefaultAddress
}
if cfg.Timeout == 0 {
cfg.Timeout = DefaultTimeout
}
if cfg.MaxIdle == 0 {
cfg.MaxIdle = DefaultMaxIdle
}
r ... | go | func Dial(cfg *DialConfig) (*Redis, error) {
if cfg == nil {
cfg = &DialConfig{}
}
if cfg.Network == "" {
cfg.Network = DefaultNetwork
}
if cfg.Address == "" {
cfg.Address = DefaultAddress
}
if cfg.Timeout == 0 {
cfg.Timeout = DefaultTimeout
}
if cfg.MaxIdle == 0 {
cfg.MaxIdle = DefaultMaxIdle
}
r ... | [
"func",
"Dial",
"(",
"cfg",
"*",
"DialConfig",
")",
"(",
"*",
"Redis",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"cfg",
"=",
"&",
"DialConfig",
"{",
"}",
"\n",
"}",
"\n",
"if",
"cfg",
".",
"Network",
"==",
"\"",
"\"",
"{",
"cfg",
... | // Dial new a redis client with DialConfig | [
"Dial",
"new",
"a",
"redis",
"client",
"with",
"DialConfig"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L474-L508 |
138,925 | xuyu/goredis | redis.go | DialURL | func DialURL(rawurl string) (*Redis, error) {
dialConfig, err := newDialConfigFromURLString(rawurl)
if err != nil {
return nil, err
}
return Dial(dialConfig)
} | go | func DialURL(rawurl string) (*Redis, error) {
dialConfig, err := newDialConfigFromURLString(rawurl)
if err != nil {
return nil, err
}
return Dial(dialConfig)
} | [
"func",
"DialURL",
"(",
"rawurl",
"string",
")",
"(",
"*",
"Redis",
",",
"error",
")",
"{",
"dialConfig",
",",
"err",
":=",
"newDialConfigFromURLString",
"(",
"rawurl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
... | // DialURL new a redis client with URL-like argument | [
"DialURL",
"new",
"a",
"redis",
"client",
"with",
"URL",
"-",
"like",
"argument"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L511-L517 |
138,926 | xuyu/goredis | redis.go | IntegerValue | func (rp *Reply) IntegerValue() (int64, error) {
if rp.Type == ErrorReply {
return 0, errors.New(rp.Error)
}
if rp.Type != IntegerReply {
return 0, errors.New("invalid reply type, not integer")
}
return rp.Integer, nil
} | go | func (rp *Reply) IntegerValue() (int64, error) {
if rp.Type == ErrorReply {
return 0, errors.New(rp.Error)
}
if rp.Type != IntegerReply {
return 0, errors.New("invalid reply type, not integer")
}
return rp.Integer, nil
} | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"IntegerValue",
"(",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"0",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
")",
"\n",
"}",
"\n",
"if... | // IntegerValue returns redis reply number value | [
"IntegerValue",
"returns",
"redis",
"reply",
"number",
"value"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L540-L548 |
138,927 | xuyu/goredis | redis.go | BoolValue | func (rp *Reply) BoolValue() (bool, error) {
if rp.Type == ErrorReply {
return false, errors.New(rp.Error)
}
if rp.Type != IntegerReply {
return false, errors.New("invalid reply type, not integer")
}
return rp.Integer != 0, nil
} | go | func (rp *Reply) BoolValue() (bool, error) {
if rp.Type == ErrorReply {
return false, errors.New(rp.Error)
}
if rp.Type != IntegerReply {
return false, errors.New("invalid reply type, not integer")
}
return rp.Integer != 0, nil
} | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"BoolValue",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"false",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
")",
"\n",
"}",
"\n",
"if... | // BoolValue returns redis reply integer
// which are also extensively used in order to return true or false.
// For instance commands like EXISTS or SISMEMBER will return 1 for true and 0 for false. | [
"BoolValue",
"returns",
"redis",
"reply",
"integer",
"which",
"are",
"also",
"extensively",
"used",
"in",
"order",
"to",
"return",
"true",
"or",
"false",
".",
"For",
"instance",
"commands",
"like",
"EXISTS",
"or",
"SISMEMBER",
"will",
"return",
"1",
"for",
"... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L553-L561 |
138,928 | xuyu/goredis | redis.go | StatusValue | func (rp *Reply) StatusValue() (string, error) {
if rp.Type == ErrorReply {
return "", errors.New(rp.Error)
}
if rp.Type != StatusReply {
return "", errors.New("invalid reply type, not status")
}
return rp.Status, nil
} | go | func (rp *Reply) StatusValue() (string, error) {
if rp.Type == ErrorReply {
return "", errors.New(rp.Error)
}
if rp.Type != StatusReply {
return "", errors.New("invalid reply type, not status")
}
return rp.Status, nil
} | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"StatusValue",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
")",
"\n",
"}",
"\... | // StatusValue indicates redis reply a status string | [
"StatusValue",
"indicates",
"redis",
"reply",
"a",
"status",
"string"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L564-L572 |
138,929 | xuyu/goredis | redis.go | OKValue | func (rp *Reply) OKValue() error {
if rp.Type == ErrorReply {
return errors.New(rp.Error)
}
if rp.Type != StatusReply {
return errors.New("invalid reply type, not status")
}
if rp.Status == "OK" {
return nil
}
return errors.New(rp.Status)
} | go | func (rp *Reply) OKValue() error {
if rp.Type == ErrorReply {
return errors.New(rp.Error)
}
if rp.Type != StatusReply {
return errors.New("invalid reply type, not status")
}
if rp.Status == "OK" {
return nil
}
return errors.New(rp.Status)
} | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"OKValue",
"(",
")",
"error",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
")",
"\n",
"}",
"\n",
"if",
"rp",
".",
"Type",
"!=",
"StatusReply"... | // OKValue indicates redis reply a OK status string | [
"OKValue",
"indicates",
"redis",
"reply",
"a",
"OK",
"status",
"string"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L575-L586 |
138,930 | xuyu/goredis | redis.go | BytesValue | func (rp *Reply) BytesValue() ([]byte, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != BulkReply {
return nil, errors.New("invalid reply type, not bulk")
}
return rp.Bulk, nil
} | go | func (rp *Reply) BytesValue() ([]byte, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != BulkReply {
return nil, errors.New("invalid reply type, not bulk")
}
return rp.Bulk, nil
} | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"BytesValue",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
")",
"\n",
"}",
... | // BytesValue indicates redis reply a bulk which maybe nil | [
"BytesValue",
"indicates",
"redis",
"reply",
"a",
"bulk",
"which",
"maybe",
"nil"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L589-L597 |
138,931 | xuyu/goredis | redis.go | StringValue | func (rp *Reply) StringValue() (string, error) {
if rp.Type == ErrorReply {
return "", errors.New(rp.Error)
}
if rp.Type != BulkReply {
return "", errors.New("invalid reply type, not bulk")
}
if rp.Bulk == nil {
return "", nil
}
return string(rp.Bulk), nil
} | go | func (rp *Reply) StringValue() (string, error) {
if rp.Type == ErrorReply {
return "", errors.New(rp.Error)
}
if rp.Type != BulkReply {
return "", errors.New("invalid reply type, not bulk")
}
if rp.Bulk == nil {
return "", nil
}
return string(rp.Bulk), nil
} | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"StringValue",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
")",
"\n",
"}",
"\... | // StringValue indicates redis reply a bulk which should not be nil | [
"StringValue",
"indicates",
"redis",
"reply",
"a",
"bulk",
"which",
"should",
"not",
"be",
"nil"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L600-L611 |
138,932 | xuyu/goredis | redis.go | MultiValue | func (rp *Reply) MultiValue() ([]*Reply, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("invalid reply type, not multi bulk")
}
return rp.Multi, nil
} | go | func (rp *Reply) MultiValue() ([]*Reply, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("invalid reply type, not multi bulk")
}
return rp.Multi, nil
} | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"MultiValue",
"(",
")",
"(",
"[",
"]",
"*",
"Reply",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
")",
"\n",... | // MultiValue indicates redis reply a multi bulk | [
"MultiValue",
"indicates",
"redis",
"reply",
"a",
"multi",
"bulk"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L614-L622 |
138,933 | xuyu/goredis | redis.go | HashValue | func (rp *Reply) HashValue() (map[string]string, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("invalid reply type, not multi bulk")
}
result := make(map[string]string)
if rp.Multi != nil {
length := len(rp.Multi)
for i := 0; i < l... | go | func (rp *Reply) HashValue() (map[string]string, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("invalid reply type, not multi bulk")
}
result := make(map[string]string)
if rp.Multi != nil {
length := len(rp.Multi)
for i := 0; i < l... | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"HashValue",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
... | // HashValue indicates redis reply a multi value which represent hash map | [
"HashValue",
"indicates",
"redis",
"reply",
"a",
"multi",
"value",
"which",
"represent",
"hash",
"map"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L625-L648 |
138,934 | xuyu/goredis | redis.go | ListValue | func (rp *Reply) ListValue() ([]string, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("invalid reply type, not multi bulk")
}
var result []string
if rp.Multi != nil {
for _, subrp := range rp.Multi {
item, err := subrp.StringValue... | go | func (rp *Reply) ListValue() ([]string, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("invalid reply type, not multi bulk")
}
var result []string
if rp.Multi != nil {
for _, subrp := range rp.Multi {
item, err := subrp.StringValue... | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"ListValue",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
")",
"\n",
"}",... | // ListValue indicates redis reply a multi value which represent list | [
"ListValue",
"indicates",
"redis",
"reply",
"a",
"multi",
"value",
"which",
"represent",
"list"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L651-L669 |
138,935 | xuyu/goredis | redis.go | BytesArrayValue | func (rp *Reply) BytesArrayValue() ([][]byte, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("invalid reply type, not multi bulk")
}
var result [][]byte
if rp.Multi != nil {
for _, subrp := range rp.Multi {
b, err := subrp.BytesVal... | go | func (rp *Reply) BytesArrayValue() ([][]byte, error) {
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("invalid reply type, not multi bulk")
}
var result [][]byte
if rp.Multi != nil {
for _, subrp := range rp.Multi {
b, err := subrp.BytesVal... | [
"func",
"(",
"rp",
"*",
"Reply",
")",
"BytesArrayValue",
"(",
")",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"rp",
".",
"Type",
"==",
"ErrorReply",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"rp",
".",
"Error",
"... | // BytesArrayValue indicates redis reply a multi value
// which represent list, but item in the list maybe nil | [
"BytesArrayValue",
"indicates",
"redis",
"reply",
"a",
"multi",
"value",
"which",
"represent",
"list",
"but",
"item",
"in",
"the",
"list",
"maybe",
"nil"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/redis.go#L673-L691 |
138,936 | xuyu/goredis | transactions.go | Discard | func (t *Transaction) Discard() error {
if err := t.conn.SendCommand("DISCARD"); err != nil {
return err
}
_, err := t.conn.RecvReply()
return err
} | go | func (t *Transaction) Discard() error {
if err := t.conn.SendCommand("DISCARD"); err != nil {
return err
}
_, err := t.conn.RecvReply()
return err
} | [
"func",
"(",
"t",
"*",
"Transaction",
")",
"Discard",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"t",
".",
"conn",
".",
"SendCommand",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
... | // Discard flushes all previously queued commands in a transaction
// and restores the connection state to normal.
// If WATCH was used, DISCARD unwatches all keys. | [
"Discard",
"flushes",
"all",
"previously",
"queued",
"commands",
"in",
"a",
"transaction",
"and",
"restores",
"the",
"connection",
"state",
"to",
"normal",
".",
"If",
"WATCH",
"was",
"used",
"DISCARD",
"unwatches",
"all",
"keys",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/transactions.go#L42-L48 |
138,937 | xuyu/goredis | transactions.go | Watch | func (t *Transaction) Watch(keys ...string) error {
args := packArgs("WATCH", keys)
if err := t.conn.SendCommand(args...); err != nil {
return err
}
_, err := t.conn.RecvReply()
return err
} | go | func (t *Transaction) Watch(keys ...string) error {
args := packArgs("WATCH", keys)
if err := t.conn.SendCommand(args...); err != nil {
return err
}
_, err := t.conn.RecvReply()
return err
} | [
"func",
"(",
"t",
"*",
"Transaction",
")",
"Watch",
"(",
"keys",
"...",
"string",
")",
"error",
"{",
"args",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"keys",
")",
"\n",
"if",
"err",
":=",
"t",
".",
"conn",
".",
"SendCommand",
"(",
"args",
"...",
"... | // Watch marks the given keys to be watched for conditional execution of a transaction. | [
"Watch",
"marks",
"the",
"given",
"keys",
"to",
"be",
"watched",
"for",
"conditional",
"execution",
"of",
"a",
"transaction",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/transactions.go#L51-L58 |
138,938 | xuyu/goredis | transactions.go | Exec | func (t *Transaction) Exec() ([]*Reply, error) {
if err := t.conn.SendCommand("EXEC"); err != nil {
return nil, err
}
rp, err := t.conn.RecvReply()
if err != nil {
return nil, err
}
return rp.MultiValue()
} | go | func (t *Transaction) Exec() ([]*Reply, error) {
if err := t.conn.SendCommand("EXEC"); err != nil {
return nil, err
}
rp, err := t.conn.RecvReply()
if err != nil {
return nil, err
}
return rp.MultiValue()
} | [
"func",
"(",
"t",
"*",
"Transaction",
")",
"Exec",
"(",
")",
"(",
"[",
"]",
"*",
"Reply",
",",
"error",
")",
"{",
"if",
"err",
":=",
"t",
".",
"conn",
".",
"SendCommand",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",... | // Exec executes all previously queued commands in a transaction
// and restores the connection state to normal.
// When using WATCH, EXEC will execute commands only if the watched keys were not modified,
// allowing for a check-and-set mechanism. | [
"Exec",
"executes",
"all",
"previously",
"queued",
"commands",
"in",
"a",
"transaction",
"and",
"restores",
"the",
"connection",
"state",
"to",
"normal",
".",
"When",
"using",
"WATCH",
"EXEC",
"will",
"execute",
"commands",
"only",
"if",
"the",
"watched",
"key... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/transactions.go#L74-L83 |
138,939 | xuyu/goredis | transactions.go | Command | func (t *Transaction) Command(args ...interface{}) error {
args2 := packArgs(args...)
if err := t.conn.SendCommand(args2...); err != nil {
return err
}
rp, err := t.conn.RecvReply()
if err != nil {
return err
}
s, err := rp.StatusValue()
if err != nil {
return err
}
if s != "QUEUED" {
return errors.Ne... | go | func (t *Transaction) Command(args ...interface{}) error {
args2 := packArgs(args...)
if err := t.conn.SendCommand(args2...); err != nil {
return err
}
rp, err := t.conn.RecvReply()
if err != nil {
return err
}
s, err := rp.StatusValue()
if err != nil {
return err
}
if s != "QUEUED" {
return errors.Ne... | [
"func",
"(",
"t",
"*",
"Transaction",
")",
"Command",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"args2",
":=",
"packArgs",
"(",
"args",
"...",
")",
"\n",
"if",
"err",
":=",
"t",
".",
"conn",
".",
"SendCommand",
"(",
"args2",
"..... | // Command send raw redis command to redis server
// and redis will return QUEUED back | [
"Command",
"send",
"raw",
"redis",
"command",
"to",
"redis",
"server",
"and",
"redis",
"will",
"return",
"QUEUED",
"back"
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/transactions.go#L87-L104 |
138,940 | xuyu/goredis | connection.go | Echo | func (r *Redis) Echo(message string) (string, error) {
rp, err := r.ExecuteCommand("ECHO", message)
if err != nil {
return "", err
}
return rp.StringValue()
} | go | func (r *Redis) Echo(message string) (string, error) {
rp, err := r.ExecuteCommand("ECHO", message)
if err != nil {
return "", err
}
return rp.StringValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"Echo",
"(",
"message",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"message",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r... | // Echo command returns message. | [
"Echo",
"command",
"returns",
"message",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/connection.go#L4-L10 |
138,941 | xuyu/goredis | keys.go | Expire | func (r *Redis) Expire(key string, seconds int) (bool, error) {
rp, err := r.ExecuteCommand("EXPIRE", key, seconds)
if err != nil {
return false, err
}
return rp.BoolValue()
} | go | func (r *Redis) Expire(key string, seconds int) (bool, error) {
rp, err := r.ExecuteCommand("EXPIRE", key, seconds)
if err != nil {
return false, err
}
return rp.BoolValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"Expire",
"(",
"key",
"string",
",",
"seconds",
"int",
")",
"(",
"bool",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"seconds",
")",
"\n",
"i... | // Expire set a second timeout on key.
// After the timeout has expired, the key will automatically be deleted.
// A key with an associated timeout is often said to be volatile in Redis terminology. | [
"Expire",
"set",
"a",
"second",
"timeout",
"on",
"key",
".",
"After",
"the",
"timeout",
"has",
"expired",
"the",
"key",
"will",
"automatically",
"be",
"deleted",
".",
"A",
"key",
"with",
"an",
"associated",
"timeout",
"is",
"often",
"said",
"to",
"be",
"... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/keys.go#L43-L49 |
138,942 | xuyu/goredis | keys.go | Object | func (r *Redis) Object(subcommand string, arguments ...string) (*Reply, error) {
args := packArgs("OBJECT", subcommand, arguments)
return r.ExecuteCommand(args...)
} | go | func (r *Redis) Object(subcommand string, arguments ...string) (*Reply, error) {
args := packArgs("OBJECT", subcommand, arguments)
return r.ExecuteCommand(args...)
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"Object",
"(",
"subcommand",
"string",
",",
"arguments",
"...",
"string",
")",
"(",
"*",
"Reply",
",",
"error",
")",
"{",
"args",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"subcommand",
",",
"arguments",
")",
"\n",
... | // Object inspects the internals of Redis Objects associated with keys.
// It is useful for debugging or to understand if your keys are using the specially encoded data types to save space.
// Your application may also use the information reported by the OBJECT command
// to implement application level key eviction pol... | [
"Object",
"inspects",
"the",
"internals",
"of",
"Redis",
"Objects",
"associated",
"with",
"keys",
".",
"It",
"is",
"useful",
"for",
"debugging",
"or",
"to",
"understand",
"if",
"your",
"keys",
"are",
"using",
"the",
"specially",
"encoded",
"data",
"types",
"... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/keys.go#L119-L122 |
138,943 | xuyu/goredis | keys.go | PExpire | func (r *Redis) PExpire(key string, milliseconds int) (bool, error) {
rp, err := r.ExecuteCommand("PEXPIRE", key, milliseconds)
if err != nil {
return false, err
}
return rp.BoolValue()
} | go | func (r *Redis) PExpire(key string, milliseconds int) (bool, error) {
rp, err := r.ExecuteCommand("PEXPIRE", key, milliseconds)
if err != nil {
return false, err
}
return rp.BoolValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"PExpire",
"(",
"key",
"string",
",",
"milliseconds",
"int",
")",
"(",
"bool",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"milliseconds",
")",
... | // PExpire works exactly like EXPIRE
// but the time to live of the key is specified in milliseconds instead of seconds. | [
"PExpire",
"works",
"exactly",
"like",
"EXPIRE",
"but",
"the",
"time",
"to",
"live",
"of",
"the",
"key",
"is",
"specified",
"in",
"milliseconds",
"instead",
"of",
"seconds",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/keys.go#L139-L145 |
138,944 | xuyu/goredis | keys.go | PExpireAt | func (r *Redis) PExpireAt(key string, timestamp int64) (bool, error) {
rp, err := r.ExecuteCommand("PEXPIREAT", key, timestamp)
if err != nil {
return false, err
}
return rp.BoolValue()
} | go | func (r *Redis) PExpireAt(key string, timestamp int64) (bool, error) {
rp, err := r.ExecuteCommand("PEXPIREAT", key, timestamp)
if err != nil {
return false, err
}
return rp.BoolValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"PExpireAt",
"(",
"key",
"string",
",",
"timestamp",
"int64",
")",
"(",
"bool",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"timestamp",
")",
"... | // PExpireAt has the same effect and semantic as EXPIREAT,
// but the Unix time at which the key will expire is specified in milliseconds instead of seconds. | [
"PExpireAt",
"has",
"the",
"same",
"effect",
"and",
"semantic",
"as",
"EXPIREAT",
"but",
"the",
"Unix",
"time",
"at",
"which",
"the",
"key",
"will",
"expire",
"is",
"specified",
"in",
"milliseconds",
"instead",
"of",
"seconds",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/keys.go#L149-L155 |
138,945 | xuyu/goredis | keys.go | Rename | func (r *Redis) Rename(key, newkey string) error {
rp, err := r.ExecuteCommand("RENAME", key, newkey)
if err != nil {
return err
}
return rp.OKValue()
} | go | func (r *Redis) Rename(key, newkey string) error {
rp, err := r.ExecuteCommand("RENAME", key, newkey)
if err != nil {
return err
}
return rp.OKValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"Rename",
"(",
"key",
",",
"newkey",
"string",
")",
"error",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"newkey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"re... | // Rename renames key to newkey.
// It returns an error when the source and destination names are the same, or when key does not exist.
// If newkey already exists it is overwritten, when this happens RENAME executes an implicit DEL operation,
// so if the deleted key contains a very big value it may cause high latency... | [
"Rename",
"renames",
"key",
"to",
"newkey",
".",
"It",
"returns",
"an",
"error",
"when",
"the",
"source",
"and",
"destination",
"names",
"are",
"the",
"same",
"or",
"when",
"key",
"does",
"not",
"exist",
".",
"If",
"newkey",
"already",
"exists",
"it",
"i... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/keys.go#L183-L189 |
138,946 | xuyu/goredis | server.go | ClientGetName | func (r *Redis) ClientGetName() ([]byte, error) {
rp, err := r.ExecuteCommand("CLIENT", "GETNAME")
if err != nil {
return nil, err
}
return rp.BytesValue()
} | go | func (r *Redis) ClientGetName() ([]byte, error) {
rp, err := r.ExecuteCommand("CLIENT", "GETNAME")
if err != nil {
return nil, err
}
return rp.BytesValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"ClientGetName",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"re... | // ClientGetName returns the name of the current connection as set by CLIENT SETNAME.
// Since every new connection starts without an associated name,
// if no name was assigned a null bulk reply is returned. | [
"ClientGetName",
"returns",
"the",
"name",
"of",
"the",
"current",
"connection",
"as",
"set",
"by",
"CLIENT",
"SETNAME",
".",
"Since",
"every",
"new",
"connection",
"starts",
"without",
"an",
"associated",
"name",
"if",
"no",
"name",
"was",
"assigned",
"a",
... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L56-L62 |
138,947 | xuyu/goredis | server.go | ClientPause | func (r *Redis) ClientPause(timeout uint64) error {
rp, err := r.ExecuteCommand("CLIENT", "PAUSE", timeout)
if err != nil {
return err
}
return rp.OKValue()
} | go | func (r *Redis) ClientPause(timeout uint64) error {
rp, err := r.ExecuteCommand("CLIENT", "PAUSE", timeout)
if err != nil {
return err
}
return rp.OKValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"ClientPause",
"(",
"timeout",
"uint64",
")",
"error",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"timeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retu... | // ClientPause stops the server processing commands from clients for some time. | [
"ClientPause",
"stops",
"the",
"server",
"processing",
"commands",
"from",
"clients",
"for",
"some",
"time",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L65-L71 |
138,948 | xuyu/goredis | server.go | ClientSetName | func (r *Redis) ClientSetName(name string) error {
rp, err := r.ExecuteCommand("CLIENT", "SETNAME", name)
if err != nil {
return err
}
return rp.OKValue()
} | go | func (r *Redis) ClientSetName(name string) error {
rp, err := r.ExecuteCommand("CLIENT", "SETNAME", name)
if err != nil {
return err
}
return rp.OKValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"ClientSetName",
"(",
"name",
"string",
")",
"error",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",... | // ClientSetName assigns a name to the current connection. | [
"ClientSetName",
"assigns",
"a",
"name",
"to",
"the",
"current",
"connection",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L74-L80 |
138,949 | xuyu/goredis | server.go | ConfigGet | func (r *Redis) ConfigGet(parameter string) (map[string]string, error) {
rp, err := r.ExecuteCommand("CONFIG", "GET", parameter)
if err != nil {
return nil, err
}
return rp.HashValue()
} | go | func (r *Redis) ConfigGet(parameter string) (map[string]string, error) {
rp, err := r.ExecuteCommand("CONFIG", "GET", parameter)
if err != nil {
return nil, err
}
return rp.HashValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"ConfigGet",
"(",
"parameter",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"param... | // ConfigGet is used to read the configuration parameters of a running Redis server.
// Not all the configuration parameters are supported in Redis 2.4,
// while Redis 2.6 can read the whole configuration of a server using this command.
// CONFIG GET takes a single argument, which is a glob-style pattern. | [
"ConfigGet",
"is",
"used",
"to",
"read",
"the",
"configuration",
"parameters",
"of",
"a",
"running",
"Redis",
"server",
".",
"Not",
"all",
"the",
"configuration",
"parameters",
"are",
"supported",
"in",
"Redis",
"2",
".",
"4",
"while",
"Redis",
"2",
".",
"... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L86-L92 |
138,950 | xuyu/goredis | server.go | ConfigSet | func (r *Redis) ConfigSet(parameter, value string) error {
rp, err := r.ExecuteCommand("CONFIG", "SET", parameter, value)
if err != nil {
return err
}
return rp.OKValue()
} | go | func (r *Redis) ConfigSet(parameter, value string) error {
rp, err := r.ExecuteCommand("CONFIG", "SET", parameter, value)
if err != nil {
return err
}
return rp.OKValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"ConfigSet",
"(",
"parameter",
",",
"value",
"string",
")",
"error",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"parameter",
",",
"value",
")",
"\n",
"if",
... | // ConfigSet is used in order to reconfigure the server at run time without the need to restart Redis.
// You can change both trivial parameters or switch from one to another persistence option using this command. | [
"ConfigSet",
"is",
"used",
"in",
"order",
"to",
"reconfigure",
"the",
"server",
"at",
"run",
"time",
"without",
"the",
"need",
"to",
"restart",
"Redis",
".",
"You",
"can",
"change",
"both",
"trivial",
"parameters",
"or",
"switch",
"from",
"one",
"to",
"ano... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L108-L114 |
138,951 | xuyu/goredis | server.go | DBSize | func (r *Redis) DBSize() (int64, error) {
rp, err := r.ExecuteCommand("DBSIZE")
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | go | func (r *Redis) DBSize() (int64, error) {
rp, err := r.ExecuteCommand("DBSIZE")
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"DBSize",
"(",
")",
"(",
"int64",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}"... | // DBSize return the number of keys in the currently-selected database. | [
"DBSize",
"return",
"the",
"number",
"of",
"keys",
"in",
"the",
"currently",
"-",
"selected",
"database",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L132-L138 |
138,952 | xuyu/goredis | server.go | DebugObject | func (r *Redis) DebugObject(key string) (string, error) {
rp, err := r.ExecuteCommand("DEBUG", "OBJECT", key)
if err != nil {
return "", err
}
return rp.StatusValue()
} | go | func (r *Redis) DebugObject(key string) (string, error) {
rp, err := r.ExecuteCommand("DEBUG", "OBJECT", key)
if err != nil {
return "", err
}
return rp.StatusValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"DebugObject",
"(",
"key",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"key",
")",
"\n",
"if",
"err",
"!="... | // DebugObject is a debugging command that should not be used by clients. | [
"DebugObject",
"is",
"a",
"debugging",
"command",
"that",
"should",
"not",
"be",
"used",
"by",
"clients",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L141-L147 |
138,953 | xuyu/goredis | server.go | Monitor | func (r *Redis) Monitor() (*MonitorCommand, error) {
c, err := r.pool.Get()
if err != nil {
return nil, err
}
if err := c.SendCommand("MONITOR"); err != nil {
return nil, err
}
rp, err := c.RecvReply()
if err != nil {
return nil, err
}
if err := rp.OKValue(); err != nil {
return nil, err
}
return &Mo... | go | func (r *Redis) Monitor() (*MonitorCommand, error) {
c, err := r.pool.Get()
if err != nil {
return nil, err
}
if err := c.SendCommand("MONITOR"); err != nil {
return nil, err
}
rp, err := c.RecvReply()
if err != nil {
return nil, err
}
if err := rp.OKValue(); err != nil {
return nil, err
}
return &Mo... | [
"func",
"(",
"r",
"*",
"Redis",
")",
"Monitor",
"(",
")",
"(",
"*",
"MonitorCommand",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"r",
".",
"pool",
".",
"Get",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n... | // Monitor sned MONITOR command to redis server. | [
"Monitor",
"sned",
"MONITOR",
"command",
"to",
"redis",
"server",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L195-L211 |
138,954 | xuyu/goredis | server.go | Receive | func (m *MonitorCommand) Receive() (string, error) {
rp, err := m.conn.RecvReply()
if err != nil {
return "", err
}
return rp.StatusValue()
} | go | func (m *MonitorCommand) Receive() (string, error) {
rp, err := m.conn.RecvReply()
if err != nil {
return "", err
}
return rp.StatusValue()
} | [
"func",
"(",
"m",
"*",
"MonitorCommand",
")",
"Receive",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"m",
".",
"conn",
".",
"RecvReply",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err... | // Receive read from redis server and return the reply. | [
"Receive",
"read",
"from",
"redis",
"server",
"and",
"return",
"the",
"reply",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L214-L220 |
138,955 | xuyu/goredis | server.go | Save | func (r *Redis) Save() error {
rp, err := r.ExecuteCommand("SAVE")
if err != nil {
return err
}
return rp.OKValue()
} | go | func (r *Redis) Save() error {
rp, err := r.ExecuteCommand("SAVE")
if err != nil {
return err
}
return rp.OKValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"Save",
"(",
")",
"error",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"rp",
".",
"OKValue"... | // Save performs a synchronous save of the dataset
// producing a point in time snapshot of all the data inside the Redis instance,
// in the form of an RDB file.
// You almost never want to call SAVE in production environments
// where it will block all the other clients. Instead usually BGSAVE is used. | [
"Save",
"performs",
"a",
"synchronous",
"save",
"of",
"the",
"dataset",
"producing",
"a",
"point",
"in",
"time",
"snapshot",
"of",
"all",
"the",
"data",
"inside",
"the",
"Redis",
"instance",
"in",
"the",
"form",
"of",
"an",
"RDB",
"file",
".",
"You",
"al... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L232-L238 |
138,956 | xuyu/goredis | server.go | SlowLogGet | func (r *Redis) SlowLogGet(n int) ([]*SlowLog, error) {
rp, err := r.ExecuteCommand("SLOWLOG", "GET", n)
if err != nil {
return nil, err
}
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("slowlog get protocol error")
}
var slow []*SlowLog
fo... | go | func (r *Redis) SlowLogGet(n int) ([]*SlowLog, error) {
rp, err := r.ExecuteCommand("SLOWLOG", "GET", n)
if err != nil {
return nil, err
}
if rp.Type == ErrorReply {
return nil, errors.New(rp.Error)
}
if rp.Type != MultiReply {
return nil, errors.New("slowlog get protocol error")
}
var slow []*SlowLog
fo... | [
"func",
"(",
"r",
"*",
"Redis",
")",
"SlowLogGet",
"(",
"n",
"int",
")",
"(",
"[",
"]",
"*",
"SlowLog",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"n",
")",
"\n",
"if",
... | // SlowLogGet returns slow logs. | [
"SlowLogGet",
"returns",
"slow",
"logs",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/server.go#L293-L328 |
138,957 | xuyu/goredis | lists.go | BLPop | func (r *Redis) BLPop(keys []string, timeout int) ([]string, error) {
args := packArgs("BLPOP", keys, timeout)
rp, err := r.ExecuteCommand(args...)
if err != nil {
return nil, err
}
if rp.Multi == nil {
return nil, nil
}
return rp.ListValue()
} | go | func (r *Redis) BLPop(keys []string, timeout int) ([]string, error) {
args := packArgs("BLPOP", keys, timeout)
rp, err := r.ExecuteCommand(args...)
if err != nil {
return nil, err
}
if rp.Multi == nil {
return nil, nil
}
return rp.ListValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"BLPop",
"(",
"keys",
"[",
"]",
"string",
",",
"timeout",
"int",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"args",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"keys",
",",
"timeout",
")",
"\n",
"rp",... | // BLPop is a blocking list pop primitive.
// It is the blocking version of LPOP
// because it blocks the connection when there are no elements to pop from any of the given lists.
// An element is popped from the head of the first list that is non-empty,
// with the given keys being checked in the order that they are g... | [
"BLPop",
"is",
"a",
"blocking",
"list",
"pop",
"primitive",
".",
"It",
"is",
"the",
"blocking",
"version",
"of",
"LPOP",
"because",
"it",
"blocks",
"the",
"connection",
"when",
"there",
"are",
"no",
"elements",
"to",
"pop",
"from",
"any",
"of",
"the",
"g... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/lists.go#L11-L21 |
138,958 | xuyu/goredis | lists.go | LSet | func (r *Redis) LSet(key string, index int, value string) error {
rp, err := r.ExecuteCommand("LSET", key, index, value)
if err != nil {
return err
}
return rp.OKValue()
} | go | func (r *Redis) LSet(key string, index int, value string) error {
rp, err := r.ExecuteCommand("LSET", key, index, value)
if err != nil {
return err
}
return rp.OKValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"LSet",
"(",
"key",
"string",
",",
"index",
"int",
",",
"value",
"string",
")",
"error",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"index",
",",
"value",
")",
... | // LSet sets the list element at index to value. For more information on the index argument, see LINDEX.
// An error is returned for out of range indexes. | [
"LSet",
"sets",
"the",
"list",
"element",
"at",
"index",
"to",
"value",
".",
"For",
"more",
"information",
"on",
"the",
"index",
"argument",
"see",
"LINDEX",
".",
"An",
"error",
"is",
"returned",
"for",
"out",
"of",
"range",
"indexes",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/lists.go#L164-L170 |
138,959 | xuyu/goredis | lists.go | RPush | func (r *Redis) RPush(key string, values ...string) (int64, error) {
args := packArgs("RPUSH", key, values)
rp, err := r.ExecuteCommand(args...)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | go | func (r *Redis) RPush(key string, values ...string) (int64, error) {
args := packArgs("RPUSH", key, values)
rp, err := r.ExecuteCommand(args...)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"RPush",
"(",
"key",
"string",
",",
"values",
"...",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"args",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"key",
",",
"values",
")",
"\n",
"rp",
",",
"err",
":... | // RPush insert all the specified values at the tail of the list stored at key.
// If key does not exist, it is created as empty list before performing the push operation.
// When key holds a value that is not a list, an error is returned. | [
"RPush",
"insert",
"all",
"the",
"specified",
"values",
"at",
"the",
"tail",
"of",
"the",
"list",
"stored",
"at",
"key",
".",
"If",
"key",
"does",
"not",
"exist",
"it",
"is",
"created",
"as",
"empty",
"list",
"before",
"performing",
"the",
"push",
"opera... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/lists.go#L211-L218 |
138,960 | xuyu/goredis | lists.go | RPushx | func (r *Redis) RPushx(key, value string) (int64, error) {
rp, err := r.ExecuteCommand("RPUSHX", key, value)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | go | func (r *Redis) RPushx(key, value string) (int64, error) {
rp, err := r.ExecuteCommand("RPUSHX", key, value)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"RPushx",
"(",
"key",
",",
"value",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"rp",
",",
"err",
":=",
"r",
".",
"ExecuteCommand",
"(",
"\"",
"\"",
",",
"key",
",",
"value",
")",
"\n",
"if",
"err",... | // RPushx inserts value at the tail of the list stored at key,
// only if key already exists and holds a list.
// In contrary to RPUSH, no operation will be performed when key does not yet exist. | [
"RPushx",
"inserts",
"value",
"at",
"the",
"tail",
"of",
"the",
"list",
"stored",
"at",
"key",
"only",
"if",
"key",
"already",
"exists",
"and",
"holds",
"a",
"list",
".",
"In",
"contrary",
"to",
"RPUSH",
"no",
"operation",
"will",
"be",
"performed",
"whe... | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/lists.go#L223-L229 |
138,961 | xuyu/goredis | hyperloglog.go | PFAdd | func (r *Redis) PFAdd(key string, elements ...string) (int64, error) {
args := packArgs("PFADD", key, elements)
rp, err := r.ExecuteCommand(args...)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | go | func (r *Redis) PFAdd(key string, elements ...string) (int64, error) {
args := packArgs("PFADD", key, elements)
rp, err := r.ExecuteCommand(args...)
if err != nil {
return 0, err
}
return rp.IntegerValue()
} | [
"func",
"(",
"r",
"*",
"Redis",
")",
"PFAdd",
"(",
"key",
"string",
",",
"elements",
"...",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"args",
":=",
"packArgs",
"(",
"\"",
"\"",
",",
"key",
",",
"elements",
")",
"\n",
"rp",
",",
"err",
... | // PFAdd adds all the element arguments to the HyperLogLog data structure
// stored at the variable name specified as first argument. | [
"PFAdd",
"adds",
"all",
"the",
"element",
"arguments",
"to",
"the",
"HyperLogLog",
"data",
"structure",
"stored",
"at",
"the",
"variable",
"name",
"specified",
"as",
"first",
"argument",
"."
] | 89fbe9474b3758ff3adf0b7b29c95aeed115fb7b | https://github.com/xuyu/goredis/blob/89fbe9474b3758ff3adf0b7b29c95aeed115fb7b/hyperloglog.go#L5-L12 |
138,962 | marpaia/graphite-golang | graphite.go | Connect | func (graphite *Graphite) Connect() error {
if !graphite.IsNop() {
if graphite.conn != nil {
graphite.conn.Close()
}
address := fmt.Sprintf("%s:%d", graphite.Host, graphite.Port)
if graphite.Timeout == 0 {
graphite.Timeout = defaultTimeout * time.Second
}
var err error
var conn net.Conn
if gr... | go | func (graphite *Graphite) Connect() error {
if !graphite.IsNop() {
if graphite.conn != nil {
graphite.conn.Close()
}
address := fmt.Sprintf("%s:%d", graphite.Host, graphite.Port)
if graphite.Timeout == 0 {
graphite.Timeout = defaultTimeout * time.Second
}
var err error
var conn net.Conn
if gr... | [
"func",
"(",
"graphite",
"*",
"Graphite",
")",
"Connect",
"(",
")",
"error",
"{",
"if",
"!",
"graphite",
".",
"IsNop",
"(",
")",
"{",
"if",
"graphite",
".",
"conn",
"!=",
"nil",
"{",
"graphite",
".",
"conn",
".",
"Close",
"(",
")",
"\n",
"}",
"\n... | // Given a Graphite struct, Connect populates the Graphite.conn field with an
// appropriate TCP connection | [
"Given",
"a",
"Graphite",
"struct",
"Connect",
"populates",
"the",
"Graphite",
".",
"conn",
"field",
"with",
"an",
"appropriate",
"TCP",
"connection"
] | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L37-L70 |
138,963 | marpaia/graphite-golang | graphite.go | Disconnect | func (graphite *Graphite) Disconnect() error {
err := graphite.conn.Close()
graphite.conn = nil
return err
} | go | func (graphite *Graphite) Disconnect() error {
err := graphite.conn.Close()
graphite.conn = nil
return err
} | [
"func",
"(",
"graphite",
"*",
"Graphite",
")",
"Disconnect",
"(",
")",
"error",
"{",
"err",
":=",
"graphite",
".",
"conn",
".",
"Close",
"(",
")",
"\n",
"graphite",
".",
"conn",
"=",
"nil",
"\n",
"return",
"err",
"\n",
"}"
] | // Given a Graphite struct, Disconnect closes the Graphite.conn field | [
"Given",
"a",
"Graphite",
"struct",
"Disconnect",
"closes",
"the",
"Graphite",
".",
"conn",
"field"
] | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L73-L77 |
138,964 | marpaia/graphite-golang | graphite.go | SendMetric | func (graphite *Graphite) SendMetric(metric Metric) error {
metrics := make([]Metric, 1)
metrics[0] = metric
return graphite.sendMetrics(metrics)
} | go | func (graphite *Graphite) SendMetric(metric Metric) error {
metrics := make([]Metric, 1)
metrics[0] = metric
return graphite.sendMetrics(metrics)
} | [
"func",
"(",
"graphite",
"*",
"Graphite",
")",
"SendMetric",
"(",
"metric",
"Metric",
")",
"error",
"{",
"metrics",
":=",
"make",
"(",
"[",
"]",
"Metric",
",",
"1",
")",
"\n",
"metrics",
"[",
"0",
"]",
"=",
"metric",
"\n\n",
"return",
"graphite",
"."... | // Given a Metric struct, the SendMetric method sends the supplied metric to the
// Graphite connection that the method is called upon | [
"Given",
"a",
"Metric",
"struct",
"the",
"SendMetric",
"method",
"sends",
"the",
"supplied",
"metric",
"to",
"the",
"Graphite",
"connection",
"that",
"the",
"method",
"is",
"called",
"upon"
] | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L81-L86 |
138,965 | marpaia/graphite-golang | graphite.go | sendMetrics | func (graphite *Graphite) sendMetrics(metrics []Metric) error {
if graphite.IsNop() {
for _, metric := range metrics {
log.Printf("Graphite: %s\n", metric)
}
return nil
}
zeroed_metric := Metric{} // ignore unintialized metrics
buf := bytes.NewBufferString("")
for _, metric := range metrics {
if metric ... | go | func (graphite *Graphite) sendMetrics(metrics []Metric) error {
if graphite.IsNop() {
for _, metric := range metrics {
log.Printf("Graphite: %s\n", metric)
}
return nil
}
zeroed_metric := Metric{} // ignore unintialized metrics
buf := bytes.NewBufferString("")
for _, metric := range metrics {
if metric ... | [
"func",
"(",
"graphite",
"*",
"Graphite",
")",
"sendMetrics",
"(",
"metrics",
"[",
"]",
"Metric",
")",
"error",
"{",
"if",
"graphite",
".",
"IsNop",
"(",
")",
"{",
"for",
"_",
",",
"metric",
":=",
"range",
"metrics",
"{",
"log",
".",
"Printf",
"(",
... | // sendMetrics is an internal function that is used to write to the TCP
// connection in order to communicate metrics to the remote Graphite host | [
"sendMetrics",
"is",
"an",
"internal",
"function",
"that",
"is",
"used",
"to",
"write",
"to",
"the",
"TCP",
"connection",
"in",
"order",
"to",
"communicate",
"metrics",
"to",
"the",
"remote",
"Graphite",
"host"
] | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L96-L132 |
138,966 | marpaia/graphite-golang | graphite.go | SimpleSend | func (graphite *Graphite) SimpleSend(stat string, value string) error {
metrics := make([]Metric, 1)
metrics[0] = NewMetric(stat, value, time.Now().Unix())
err := graphite.sendMetrics(metrics)
if err != nil {
return err
}
return nil
} | go | func (graphite *Graphite) SimpleSend(stat string, value string) error {
metrics := make([]Metric, 1)
metrics[0] = NewMetric(stat, value, time.Now().Unix())
err := graphite.sendMetrics(metrics)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"graphite",
"*",
"Graphite",
")",
"SimpleSend",
"(",
"stat",
"string",
",",
"value",
"string",
")",
"error",
"{",
"metrics",
":=",
"make",
"(",
"[",
"]",
"Metric",
",",
"1",
")",
"\n",
"metrics",
"[",
"0",
"]",
"=",
"NewMetric",
"(",
"... | // The SimpleSend method can be used to just pass a metric name and value and
// have it be sent to the Graphite host with the current timestamp | [
"The",
"SimpleSend",
"method",
"can",
"be",
"used",
"to",
"just",
"pass",
"a",
"metric",
"name",
"and",
"value",
"and",
"have",
"it",
"be",
"sent",
"to",
"the",
"Graphite",
"host",
"with",
"the",
"current",
"timestamp"
] | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L136-L144 |
138,967 | marpaia/graphite-golang | graphite.go | NewGraphite | func NewGraphite(host string, port int) (*Graphite, error) {
return GraphiteFactory("tcp", host, port, "")
} | go | func NewGraphite(host string, port int) (*Graphite, error) {
return GraphiteFactory("tcp", host, port, "")
} | [
"func",
"NewGraphite",
"(",
"host",
"string",
",",
"port",
"int",
")",
"(",
"*",
"Graphite",
",",
"error",
")",
"{",
"return",
"GraphiteFactory",
"(",
"\"",
"\"",
",",
"host",
",",
"port",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // NewGraphite is a factory method that's used to create a new Graphite | [
"NewGraphite",
"is",
"a",
"factory",
"method",
"that",
"s",
"used",
"to",
"create",
"a",
"new",
"Graphite"
] | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L147-L149 |
138,968 | marpaia/graphite-golang | graphite.go | NewGraphiteWithMetricPrefix | func NewGraphiteWithMetricPrefix(host string, port int, prefix string) (*Graphite, error) {
return GraphiteFactory("tcp", host, port, prefix)
} | go | func NewGraphiteWithMetricPrefix(host string, port int, prefix string) (*Graphite, error) {
return GraphiteFactory("tcp", host, port, prefix)
} | [
"func",
"NewGraphiteWithMetricPrefix",
"(",
"host",
"string",
",",
"port",
"int",
",",
"prefix",
"string",
")",
"(",
"*",
"Graphite",
",",
"error",
")",
"{",
"return",
"GraphiteFactory",
"(",
"\"",
"\"",
",",
"host",
",",
"port",
",",
"prefix",
")",
"\n"... | // NewGraphiteWithMetricPrefix is a factory method that's used to create a new Graphite with a metric prefix | [
"NewGraphiteWithMetricPrefix",
"is",
"a",
"factory",
"method",
"that",
"s",
"used",
"to",
"create",
"a",
"new",
"Graphite",
"with",
"a",
"metric",
"prefix"
] | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L152-L154 |
138,969 | marpaia/graphite-golang | graphite.go | NewGraphiteUDP | func NewGraphiteUDP(host string, port int) (*Graphite, error) {
return GraphiteFactory("udp", host, port, "")
} | go | func NewGraphiteUDP(host string, port int) (*Graphite, error) {
return GraphiteFactory("udp", host, port, "")
} | [
"func",
"NewGraphiteUDP",
"(",
"host",
"string",
",",
"port",
"int",
")",
"(",
"*",
"Graphite",
",",
"error",
")",
"{",
"return",
"GraphiteFactory",
"(",
"\"",
"\"",
",",
"host",
",",
"port",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // When a UDP connection to Graphite is required | [
"When",
"a",
"UDP",
"connection",
"to",
"Graphite",
"is",
"required"
] | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L157-L159 |
138,970 | marpaia/graphite-golang | graphite.go | NewGraphiteNop | func NewGraphiteNop(host string, port int) *Graphite {
graphiteNop, _ := GraphiteFactory("nop", host, port, "")
return graphiteNop
} | go | func NewGraphiteNop(host string, port int) *Graphite {
graphiteNop, _ := GraphiteFactory("nop", host, port, "")
return graphiteNop
} | [
"func",
"NewGraphiteNop",
"(",
"host",
"string",
",",
"port",
"int",
")",
"*",
"Graphite",
"{",
"graphiteNop",
",",
"_",
":=",
"GraphiteFactory",
"(",
"\"",
"\"",
",",
"host",
",",
"port",
",",
"\"",
"\"",
")",
"\n",
"return",
"graphiteNop",
"\n",
"}"
... | // NewGraphiteNop is a factory method that returns a Graphite struct but will
// not actually try to send any packets to a remote host and, instead, will just
// log. This is useful if you want to use Graphite in a project but don't want
// to make Graphite a requirement for the project. | [
"NewGraphiteNop",
"is",
"a",
"factory",
"method",
"that",
"returns",
"a",
"Graphite",
"struct",
"but",
"will",
"not",
"actually",
"try",
"to",
"send",
"any",
"packets",
"to",
"a",
"remote",
"host",
"and",
"instead",
"will",
"just",
"log",
".",
"This",
"is"... | 134b9af18cf31f936ebddbd11c03eead4d501601 | https://github.com/marpaia/graphite-golang/blob/134b9af18cf31f936ebddbd11c03eead4d501601/graphite.go#L165-L168 |
138,971 | minero/minero-go | server/server.go | New | func New(c *config.Config) *Server {
log.Println("Generating keypair.")
// Generate config
if c == nil {
c = config.New()
if err := c.ParseFile("./server.conf"); err != nil {
c = ConfigCreate()
}
}
s := &Server{
id: serverId(),
config: c,
privateKey: auth.GenerateKeyPair(),
// Load ... | go | func New(c *config.Config) *Server {
log.Println("Generating keypair.")
// Generate config
if c == nil {
c = config.New()
if err := c.ParseFile("./server.conf"); err != nil {
c = ConfigCreate()
}
}
s := &Server{
id: serverId(),
config: c,
privateKey: auth.GenerateKeyPair(),
// Load ... | [
"func",
"New",
"(",
"c",
"*",
"config",
".",
"Config",
")",
"*",
"Server",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"// Generate config",
"if",
"c",
"==",
"nil",
"{",
"c",
"=",
"config",
".",
"New",
"(",
")",
"\n",
"if",
"err",
... | // New initializes a new server instance and loads server.conf file if one
// exists, otherwise it'll create a new one. | [
"New",
"initializes",
"a",
"new",
"server",
"instance",
"and",
"loads",
"server",
".",
"conf",
"file",
"if",
"one",
"exists",
"otherwise",
"it",
"ll",
"create",
"a",
"new",
"one",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/server.go#L53-L78 |
138,972 | minero/minero-go | server/server.go | PublicKey | func (s *Server) PublicKey() []byte {
if s.publicKey == nil {
var err error
s.publicKey = auth.KeyExchange(&s.privateKey.PublicKey)
if s.publicKey == nil {
log.Fatal("Couldn't marshal public key:", err)
return nil
}
}
return s.publicKey
} | go | func (s *Server) PublicKey() []byte {
if s.publicKey == nil {
var err error
s.publicKey = auth.KeyExchange(&s.privateKey.PublicKey)
if s.publicKey == nil {
log.Fatal("Couldn't marshal public key:", err)
return nil
}
}
return s.publicKey
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"PublicKey",
"(",
")",
"[",
"]",
"byte",
"{",
"if",
"s",
".",
"publicKey",
"==",
"nil",
"{",
"var",
"err",
"error",
"\n",
"s",
".",
"publicKey",
"=",
"auth",
".",
"KeyExchange",
"(",
"&",
"s",
".",
"privateKe... | // PublicKey returns the ASN.1 encoded version of server's x.509 public key. | [
"PublicKey",
"returns",
"the",
"ASN",
".",
"1",
"encoded",
"version",
"of",
"server",
"s",
"x",
".",
"509",
"public",
"key",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/server.go#L84-L94 |
138,973 | minero/minero-go | server/server.go | CheckUser | func (s *Server) CheckUser(name string, secret []byte) bool {
r, err := auth.CheckUser(name, s.id, secret, s.PublicKey())
if err != nil {
return false
}
return r
} | go | func (s *Server) CheckUser(name string, secret []byte) bool {
r, err := auth.CheckUser(name, s.id, secret, s.PublicKey())
if err != nil {
return false
}
return r
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"CheckUser",
"(",
"name",
"string",
",",
"secret",
"[",
"]",
"byte",
")",
"bool",
"{",
"r",
",",
"err",
":=",
"auth",
".",
"CheckUser",
"(",
"name",
",",
"s",
".",
"id",
",",
"secret",
",",
"s",
".",
"Publi... | // CheckUser check's if user is premium, only used when config var
// "server.online_mode" = true. | [
"CheckUser",
"check",
"s",
"if",
"user",
"is",
"premium",
"only",
"used",
"when",
"config",
"var",
"server",
".",
"online_mode",
"=",
"true",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/server.go#L101-L107 |
138,974 | minero/minero-go | server/server.go | Run | func (s *Server) Run() {
var err error
addr := s.config.Get("server.host") + ":" + s.config.Get("server.port")
log.Printf("Listening on address: %q", addr)
s.net, err = net.Listen("tcp", addr)
if err != nil {
log.Fatal(err)
}
defer s.net.Close()
// Start server ticker
go s.doTick()
for !s.working {
//... | go | func (s *Server) Run() {
var err error
addr := s.config.Get("server.host") + ":" + s.config.Get("server.port")
log.Printf("Listening on address: %q", addr)
s.net, err = net.Listen("tcp", addr)
if err != nil {
log.Fatal(err)
}
defer s.net.Close()
// Start server ticker
go s.doTick()
for !s.working {
//... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Run",
"(",
")",
"{",
"var",
"err",
"error",
"\n\n",
"addr",
":=",
"s",
".",
"config",
".",
"Get",
"(",
"\"",
"\"",
")",
"+",
"\"",
"\"",
"+",
"s",
".",
"config",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",... | // Run starts up the server. | [
"Run",
"starts",
"up",
"the",
"server",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/server.go#L110-L136 |
138,975 | minero/minero-go | server/server.go | Tick | func (s *Server) Tick(t int64) {
pkt := &packet.TimeUpdate{
Time: s.gameTime,
WorldAge: t,
}
s.BroadcastPacket(pkt)
} | go | func (s *Server) Tick(t int64) {
pkt := &packet.TimeUpdate{
Time: s.gameTime,
WorldAge: t,
}
s.BroadcastPacket(pkt)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Tick",
"(",
"t",
"int64",
")",
"{",
"pkt",
":=",
"&",
"packet",
".",
"TimeUpdate",
"{",
"Time",
":",
"s",
".",
"gameTime",
",",
"WorldAge",
":",
"t",
",",
"}",
"\n",
"s",
".",
"BroadcastPacket",
"(",
"pkt",
... | // Tick updates time by one tick. Implements tick.Ticker interface. | [
"Tick",
"updates",
"time",
"by",
"one",
"tick",
".",
"Implements",
"tick",
".",
"Ticker",
"interface",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/server.go#L139-L145 |
138,976 | minero/minero-go | server/server.go | Kick | func (s *Server) Kick(p *player.Player) {
p.SendMessage("You were kicked from the server.")
msg := fmt.Sprintf("Player %q was kicked from the server.", p.Name)
s.BroadcastMessage(msg)
} | go | func (s *Server) Kick(p *player.Player) {
p.SendMessage("You were kicked from the server.")
msg := fmt.Sprintf("Player %q was kicked from the server.", p.Name)
s.BroadcastMessage(msg)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Kick",
"(",
"p",
"*",
"player",
".",
"Player",
")",
"{",
"p",
".",
"SendMessage",
"(",
"\"",
"\"",
")",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"Name",
")",
"\n",
"s",
... | // Kick kicks a player from the server | [
"Kick",
"kicks",
"a",
"player",
"from",
"the",
"server"
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/server.go#L189-L193 |
138,977 | minero/minero-go | proto/ping/ping.go | Prepare | func Prepare(motd, in, max string) []string {
return []string{
"§1",
constants.Proto, constants.Server,
motd,
in, max,
}
} | go | func Prepare(motd, in, max string) []string {
return []string{
"§1",
constants.Proto, constants.Server,
motd,
in, max,
}
} | [
"func",
"Prepare",
"(",
"motd",
",",
"in",
",",
"max",
"string",
")",
"[",
"]",
"string",
"{",
"return",
"[",
"]",
"string",
"{",
"\"",
",",
"",
"constants",
".",
"Proto",
",",
"constants",
".",
"Server",
",",
"motd",
",",
"in",
",",
"max",
",",
... | // Prepare returns a ServerListPing-able string ready to be sent over the wire. | [
"Prepare",
"returns",
"a",
"ServerListPing",
"-",
"able",
"string",
"ready",
"to",
"be",
"sent",
"over",
"the",
"wire",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/proto/ping/ping.go#L17-L24 |
138,978 | minero/minero-go | server/list/tickers/tickers.go | Len | func (l Tickers) Len() int {
l.RLock()
defer l.RUnlock()
return len(l.list)
} | go | func (l Tickers) Len() int {
l.RLock()
defer l.RUnlock()
return len(l.list)
} | [
"func",
"(",
"l",
"Tickers",
")",
"Len",
"(",
")",
"int",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"defer",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"len",
"(",
"l",
".",
"list",
")",
"\n",
"}"
] | // Len returns the number of active tickers. | [
"Len",
"returns",
"the",
"number",
"of",
"active",
"tickers",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/tickers/tickers.go#L24-L28 |
138,979 | minero/minero-go | server/list/tickers/tickers.go | GetTicker | func (l Tickers) GetTicker(id int32) tick.Ticker {
l.RLock()
defer l.RUnlock()
return l.list[id]
} | go | func (l Tickers) GetTicker(id int32) tick.Ticker {
l.RLock()
defer l.RUnlock()
return l.list[id]
} | [
"func",
"(",
"l",
"Tickers",
")",
"GetTicker",
"(",
"id",
"int32",
")",
"tick",
".",
"Ticker",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"defer",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"l",
".",
"list",
"[",
"id",
"]",
"\n",
"}"
] | // GetTicker gets a ticker from the list by its Entity Id. | [
"GetTicker",
"gets",
"a",
"ticker",
"from",
"the",
"list",
"by",
"its",
"Entity",
"Id",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/tickers/tickers.go#L42-L46 |
138,980 | minero/minero-go | server/list/tickers/tickers.go | AddTicker | func (l Tickers) AddTicker(id int32, t tick.Ticker) {
l.Lock()
l.list[id] = t
l.Unlock()
} | go | func (l Tickers) AddTicker(id int32, t tick.Ticker) {
l.Lock()
l.list[id] = t
l.Unlock()
} | [
"func",
"(",
"l",
"Tickers",
")",
"AddTicker",
"(",
"id",
"int32",
",",
"t",
"tick",
".",
"Ticker",
")",
"{",
"l",
".",
"Lock",
"(",
")",
"\n",
"l",
".",
"list",
"[",
"id",
"]",
"=",
"t",
"\n",
"l",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // AddTicker adds a ticker to the list. | [
"AddTicker",
"adds",
"a",
"ticker",
"to",
"the",
"list",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/tickers/tickers.go#L49-L53 |
138,981 | minero/minero-go | server/list/tickers/tickers.go | RemTicker | func (l Tickers) RemTicker(id int32) {
l.Lock()
delete(l.list, id)
l.Unlock()
} | go | func (l Tickers) RemTicker(id int32) {
l.Lock()
delete(l.list, id)
l.Unlock()
} | [
"func",
"(",
"l",
"Tickers",
")",
"RemTicker",
"(",
"id",
"int32",
")",
"{",
"l",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"l",
".",
"list",
",",
"id",
")",
"\n",
"l",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // RemTicker removes a ticker from the list. | [
"RemTicker",
"removes",
"a",
"ticker",
"from",
"the",
"list",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/tickers/tickers.go#L56-L60 |
138,982 | minero/minero-go | server/list/tickers/tickers.go | TickAll | func (l Tickers) TickAll(tick int64) {
l.RLock()
for _, t := range l.list {
t.Tick(tick)
}
l.RUnlock()
} | go | func (l Tickers) TickAll(tick int64) {
l.RLock()
for _, t := range l.list {
t.Tick(tick)
}
l.RUnlock()
} | [
"func",
"(",
"l",
"Tickers",
")",
"TickAll",
"(",
"tick",
"int64",
")",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"l",
".",
"list",
"{",
"t",
".",
"Tick",
"(",
"tick",
")",
"\n",
"}",
"\n",
"l",
".",
"RUnl... | // TickAll calls each ticker's Tick method. | [
"TickAll",
"calls",
"each",
"ticker",
"s",
"Tick",
"method",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/tickers/tickers.go#L63-L69 |
138,983 | minero/minero-go | chat/chat.go | StripColor | func StripColor(s string) string {
r := regexp.MustCompile(reColor)
return r.ReplaceAllString(s, "")
} | go | func StripColor(s string) string {
r := regexp.MustCompile(reColor)
return r.ReplaceAllString(s, "")
} | [
"func",
"StripColor",
"(",
"s",
"string",
")",
"string",
"{",
"r",
":=",
"regexp",
".",
"MustCompile",
"(",
"reColor",
")",
"\n",
"return",
"r",
".",
"ReplaceAllString",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // StripColor deletes color control sequences. | [
"StripColor",
"deletes",
"color",
"control",
"sequences",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/chat/chat.go#L73-L76 |
138,984 | minero/minero-go | chat/chat.go | StripFormat | func StripFormat(s string) string {
r := regexp.MustCompile(reFormat)
return r.ReplaceAllString(s, "")
} | go | func StripFormat(s string) string {
r := regexp.MustCompile(reFormat)
return r.ReplaceAllString(s, "")
} | [
"func",
"StripFormat",
"(",
"s",
"string",
")",
"string",
"{",
"r",
":=",
"regexp",
".",
"MustCompile",
"(",
"reFormat",
")",
"\n",
"return",
"r",
".",
"ReplaceAllString",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // StripFormat deletes format control sequences. | [
"StripFormat",
"deletes",
"format",
"control",
"sequences",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/chat/chat.go#L79-L82 |
138,985 | minero/minero-go | chat/chat.go | Strip | func Strip(s string) string {
r := regexp.MustCompile(reBoth)
return r.ReplaceAllString(s, "")
} | go | func Strip(s string) string {
r := regexp.MustCompile(reBoth)
return r.ReplaceAllString(s, "")
} | [
"func",
"Strip",
"(",
"s",
"string",
")",
"string",
"{",
"r",
":=",
"regexp",
".",
"MustCompile",
"(",
"reBoth",
")",
"\n",
"return",
"r",
".",
"ReplaceAllString",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // Strip deletes any chat control sequence. | [
"Strip",
"deletes",
"any",
"chat",
"control",
"sequence",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/chat/chat.go#L85-L88 |
138,986 | minero/minero-go | util/must/readwriter.go | Must | func (rw ReadWriter) Must(n int64, err error) {
// Check iff there were no errors
if rw.Err == nil {
return
}
rw.N += n
rw.Err = err
} | go | func (rw ReadWriter) Must(n int64, err error) {
// Check iff there were no errors
if rw.Err == nil {
return
}
rw.N += n
rw.Err = err
} | [
"func",
"(",
"rw",
"ReadWriter",
")",
"Must",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"// Check iff there were no errors",
"if",
"rw",
".",
"Err",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"rw",
".",
"N",
"+=",
"n",
"\n",
"rw",
".",
... | // Must provides a hook for foreign functions using 'io.Reader's or
// 'io.Writer's. | [
"Must",
"provides",
"a",
"hook",
"for",
"foreign",
"functions",
"using",
"io",
".",
"Reader",
"s",
"or",
"io",
".",
"Writer",
"s",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/util/must/readwriter.go#L21-L29 |
138,987 | minero/minero-go | util/must/readwriter.go | Result | func (rw ReadWriter) Result() (n int64, err error) {
return rw.N, rw.Err
} | go | func (rw ReadWriter) Result() (n int64, err error) {
return rw.N, rw.Err
} | [
"func",
"(",
"rw",
"ReadWriter",
")",
"Result",
"(",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"return",
"rw",
".",
"N",
",",
"rw",
".",
"Err",
"\n",
"}"
] | // Result returns all bytes read and the first error found. | [
"Result",
"returns",
"all",
"bytes",
"read",
"and",
"the",
"first",
"error",
"found",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/util/must/readwriter.go#L32-L34 |
138,988 | minero/minero-go | util/noise/simplex/simplex.go | At2d | func At2d(x, y float64) float64 {
// Noise contributions from the three corners
var n0, n1, n2 float64
// Skew the input space to determine which simplex cell we're in
var s float64 = (x + y) * f2 // Hairy factor for 2D
var i int = fastfloor(x + s)
var j int = fastfloor(y + s)
var t = float64(i+j) * g2
// Un... | go | func At2d(x, y float64) float64 {
// Noise contributions from the three corners
var n0, n1, n2 float64
// Skew the input space to determine which simplex cell we're in
var s float64 = (x + y) * f2 // Hairy factor for 2D
var i int = fastfloor(x + s)
var j int = fastfloor(y + s)
var t = float64(i+j) * g2
// Un... | [
"func",
"At2d",
"(",
"x",
",",
"y",
"float64",
")",
"float64",
"{",
"// Noise contributions from the three corners",
"var",
"n0",
",",
"n1",
",",
"n2",
"float64",
"\n\n",
"// Skew the input space to determine which simplex cell we're in",
"var",
"s",
"float64",
"=",
"... | // At2d computes 2D simplex noise. | [
"At2d",
"computes",
"2D",
"simplex",
"noise",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/util/noise/simplex/simplex.go#L39-L115 |
138,989 | minero/minero-go | server/player/metadata.go | JustLoginMetadata | func JustLoginMetadata(name string) mct.Metadata {
meta := mct.NewMetadata()
meta.Entries[0] = &mct.EntryByte{0} // Actions
meta.Entries[1] = &mct.EntryShort{300} // Drowning counter
meta.Entries[5] = &mct.EntryString{mct.String(name)} // Plate name
meta.Entries[6] = &mct.EntryByte{1... | go | func JustLoginMetadata(name string) mct.Metadata {
meta := mct.NewMetadata()
meta.Entries[0] = &mct.EntryByte{0} // Actions
meta.Entries[1] = &mct.EntryShort{300} // Drowning counter
meta.Entries[5] = &mct.EntryString{mct.String(name)} // Plate name
meta.Entries[6] = &mct.EntryByte{1... | [
"func",
"JustLoginMetadata",
"(",
"name",
"string",
")",
"mct",
".",
"Metadata",
"{",
"meta",
":=",
"mct",
".",
"NewMetadata",
"(",
")",
"\n",
"meta",
".",
"Entries",
"[",
"0",
"]",
"=",
"&",
"mct",
".",
"EntryByte",
"{",
"0",
"}",
"// Actions",
"\n"... | // JustLoginMetadata return default metadata for players who just got in. | [
"JustLoginMetadata",
"return",
"default",
"metadata",
"for",
"players",
"who",
"just",
"got",
"in",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/player/metadata.go#L8-L16 |
138,990 | minero/minero-go | proto/nbt/nbt.go | ReadFrom | func (tt *TagType) ReadFrom(r io.Reader) (n int64, err error) {
err = binary.Read(r, binary.BigEndian, tt)
if err != nil {
return 0, err
}
return 1, nil
} | go | func (tt *TagType) ReadFrom(r io.Reader) (n int64, err error) {
err = binary.Read(r, binary.BigEndian, tt)
if err != nil {
return 0, err
}
return 1, nil
} | [
"func",
"(",
"tt",
"*",
"TagType",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"err",
"=",
"binary",
".",
"Read",
"(",
"r",
",",
"binary",
".",
"BigEndian",
",",
"tt",
")",
"\n",
"if",
... | // ReadFrom satifies io.ReaderFrom interface. | [
"ReadFrom",
"satifies",
"io",
".",
"ReaderFrom",
"interface",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/proto/nbt/nbt.go#L65-L71 |
138,991 | minero/minero-go | proto/nbt/nbt.go | WriteTo | func (tt TagType) WriteTo(w io.Writer) (n int64, err error) {
err = binary.Write(w, binary.BigEndian, tt)
if err != nil {
return 0, err
}
return 1, nil
} | go | func (tt TagType) WriteTo(w io.Writer) (n int64, err error) {
err = binary.Write(w, binary.BigEndian, tt)
if err != nil {
return 0, err
}
return 1, nil
} | [
"func",
"(",
"tt",
"TagType",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"err",
"=",
"binary",
".",
"Write",
"(",
"w",
",",
"binary",
".",
"BigEndian",
",",
"tt",
")",
"\n",
"if",
"err"... | // WriteTo satifies io.WriterTo interface. | [
"WriteTo",
"satifies",
"io",
".",
"WriterTo",
"interface",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/proto/nbt/nbt.go#L74-L80 |
138,992 | minero/minero-go | proto/auth/session.go | CheckUser | func CheckUser(username, sid string, ss, pk []byte) (res bool, err error) {
var (
buf *bytes.Buffer
resp *http.Response
)
buf = bytes.NewBufferString(sid)
buf.Write(ss)
buf.Write(pk)
var url = fmt.Sprintf(BaseUrl, username, AuthDigest(buf.Bytes()))
resp, err = http.Get(url)
if err != nil {
return false... | go | func CheckUser(username, sid string, ss, pk []byte) (res bool, err error) {
var (
buf *bytes.Buffer
resp *http.Response
)
buf = bytes.NewBufferString(sid)
buf.Write(ss)
buf.Write(pk)
var url = fmt.Sprintf(BaseUrl, username, AuthDigest(buf.Bytes()))
resp, err = http.Get(url)
if err != nil {
return false... | [
"func",
"CheckUser",
"(",
"username",
",",
"sid",
"string",
",",
"ss",
",",
"pk",
"[",
"]",
"byte",
")",
"(",
"res",
"bool",
",",
"err",
"error",
")",
"{",
"var",
"(",
"buf",
"*",
"bytes",
".",
"Buffer",
"\n",
"resp",
"*",
"http",
".",
"Response"... | // CheckUser send's a HTTP request to session.minecraft.net to check player's
// authenticity. Only used by the server when online-mode=true. | [
"CheckUser",
"send",
"s",
"a",
"HTTP",
"request",
"to",
"session",
".",
"minecraft",
".",
"net",
"to",
"check",
"player",
"s",
"authenticity",
".",
"Only",
"used",
"by",
"the",
"server",
"when",
"online",
"-",
"mode",
"=",
"true",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/proto/auth/session.go#L14-L43 |
138,993 | minero/minero-go | util/uuid/uuid.go | UUID4 | func UUID4() (u UUID) {
// s := make([]byte, 16)
// n, err := rand.Read(s)
// if n != 16 || err != nil {
// return nil
// }
for i, _ := range u {
// u[i] = v
u[i] = byte(rand.Int31n(256))
}
// Set the four most significant bits (bits 12 through 15) of the
// time_hi_and_version field to the 4-bit versio... | go | func UUID4() (u UUID) {
// s := make([]byte, 16)
// n, err := rand.Read(s)
// if n != 16 || err != nil {
// return nil
// }
for i, _ := range u {
// u[i] = v
u[i] = byte(rand.Int31n(256))
}
// Set the four most significant bits (bits 12 through 15) of the
// time_hi_and_version field to the 4-bit versio... | [
"func",
"UUID4",
"(",
")",
"(",
"u",
"UUID",
")",
"{",
"// s := make([]byte, 16)",
"// n, err := rand.Read(s)",
"// if n != 16 || err != nil {",
"// \treturn nil",
"// }",
"for",
"i",
",",
"_",
":=",
"range",
"u",
"{",
"// u[i] = v",
"u",
"[",
"i",
"]",
"=",
"... | // UUID4 generates a v4 UUID using pseudo-random numbers. | [
"UUID4",
"generates",
"a",
"v4",
"UUID",
"using",
"pseudo",
"-",
"random",
"numbers",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/util/uuid/uuid.go#L33-L54 |
138,994 | minero/minero-go | server/list/players/players.go | Len | func (l Players) Len() int {
l.RLock()
defer l.RUnlock()
return len(l.list)
} | go | func (l Players) Len() int {
l.RLock()
defer l.RUnlock()
return len(l.list)
} | [
"func",
"(",
"l",
"Players",
")",
"Len",
"(",
")",
"int",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"defer",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"len",
"(",
"l",
".",
"list",
")",
"\n",
"}"
] | // Len returns the number of online players. | [
"Len",
"returns",
"the",
"number",
"of",
"online",
"players",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/players/players.go#L25-L29 |
138,995 | minero/minero-go | server/list/players/players.go | AddPlayer | func (l Players) AddPlayer(p *player.Player) {
l.Lock()
l.list[p.Name] = p
l.Unlock()
} | go | func (l Players) AddPlayer(p *player.Player) {
l.Lock()
l.list[p.Name] = p
l.Unlock()
} | [
"func",
"(",
"l",
"Players",
")",
"AddPlayer",
"(",
"p",
"*",
"player",
".",
"Player",
")",
"{",
"l",
".",
"Lock",
"(",
")",
"\n",
"l",
".",
"list",
"[",
"p",
".",
"Name",
"]",
"=",
"p",
"\n",
"l",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // AddPlayer adds a player to the list. | [
"AddPlayer",
"adds",
"a",
"player",
"to",
"the",
"list",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/players/players.go#L50-L54 |
138,996 | minero/minero-go | server/list/players/players.go | RemPlayer | func (l Players) RemPlayer(p *player.Player) {
l.Lock()
delete(l.list, p.Name)
l.Unlock()
} | go | func (l Players) RemPlayer(p *player.Player) {
l.Lock()
delete(l.list, p.Name)
l.Unlock()
} | [
"func",
"(",
"l",
"Players",
")",
"RemPlayer",
"(",
"p",
"*",
"player",
".",
"Player",
")",
"{",
"l",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"l",
".",
"list",
",",
"p",
".",
"Name",
")",
"\n",
"l",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // RemPlayer removes a player from the list. | [
"RemPlayer",
"removes",
"a",
"player",
"from",
"the",
"list",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/players/players.go#L57-L61 |
138,997 | minero/minero-go | server/list/players/players.go | BroadcastPacket | func (l Players) BroadcastPacket(pkt packet.Packet) {
l.RLock()
for _, p := range l.list {
if p.Ready {
pkt.WriteTo(p.Conn)
}
}
l.RUnlock()
} | go | func (l Players) BroadcastPacket(pkt packet.Packet) {
l.RLock()
for _, p := range l.list {
if p.Ready {
pkt.WriteTo(p.Conn)
}
}
l.RUnlock()
} | [
"func",
"(",
"l",
"Players",
")",
"BroadcastPacket",
"(",
"pkt",
"packet",
".",
"Packet",
")",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"l",
".",
"list",
"{",
"if",
"p",
".",
"Ready",
"{",
"pkt",
".",
"WriteT... | // BroadcastPacket sends a packet to all online players. | [
"BroadcastPacket",
"sends",
"a",
"packet",
"to",
"all",
"online",
"players",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/players/players.go#L64-L72 |
138,998 | minero/minero-go | server/list/players/players.go | BroadcastMessage | func (l Players) BroadcastMessage(msg string) {
l.RLock()
for _, p := range l.list {
if p.Ready {
p.SendMessage(msg)
}
}
l.RUnlock()
} | go | func (l Players) BroadcastMessage(msg string) {
l.RLock()
for _, p := range l.list {
if p.Ready {
p.SendMessage(msg)
}
}
l.RUnlock()
} | [
"func",
"(",
"l",
"Players",
")",
"BroadcastMessage",
"(",
"msg",
"string",
")",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"l",
".",
"list",
"{",
"if",
"p",
".",
"Ready",
"{",
"p",
".",
"SendMessage",
"(",
"ms... | // BroadcastMessage send a message to all online players. | [
"BroadcastMessage",
"send",
"a",
"message",
"to",
"all",
"online",
"players",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/players/players.go#L75-L83 |
138,999 | minero/minero-go | server/list/players/players.go | BroadcastLogin | func (l Players) BroadcastLogin(to *player.Player) {
l.RLock()
for _, p := range l.list {
if p.Ready {
r := &packet.EntityNamedSpawn{
Entity: p.Id(),
Name: p.Name,
X: p.X,
Y: p.Y,
Z: p.Z,
Yaw: p.Yaw,
Pitch: p.Pitch,
Item: 0,
Metadata: pla... | go | func (l Players) BroadcastLogin(to *player.Player) {
l.RLock()
for _, p := range l.list {
if p.Ready {
r := &packet.EntityNamedSpawn{
Entity: p.Id(),
Name: p.Name,
X: p.X,
Y: p.Y,
Z: p.Z,
Yaw: p.Yaw,
Pitch: p.Pitch,
Item: 0,
Metadata: pla... | [
"func",
"(",
"l",
"Players",
")",
"BroadcastLogin",
"(",
"to",
"*",
"player",
".",
"Player",
")",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"l",
".",
"list",
"{",
"if",
"p",
".",
"Ready",
"{",
"r",
":=",
"&"... | // BroadcastLogin initializes all previously online clients to a new player. | [
"BroadcastLogin",
"initializes",
"all",
"previously",
"online",
"clients",
"to",
"a",
"new",
"player",
"."
] | 93368d43a80e4ef6ee2f0e65c84dd7bc7929135c | https://github.com/minero/minero-go/blob/93368d43a80e4ef6ee2f0e65c84dd7bc7929135c/server/list/players/players.go#L86-L105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.