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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
30,000 | tsuna/gohbase | hrpc/enable.go | NewEnableTable | func NewEnableTable(ctx context.Context, table []byte) *EnableTable {
return &EnableTable{
base{
table: table,
ctx: ctx,
resultch: make(chan RPCResult, 1),
},
}
} | go | func NewEnableTable(ctx context.Context, table []byte) *EnableTable {
return &EnableTable{
base{
table: table,
ctx: ctx,
resultch: make(chan RPCResult, 1),
},
}
} | [
"func",
"NewEnableTable",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
"[",
"]",
"byte",
")",
"*",
"EnableTable",
"{",
"return",
"&",
"EnableTable",
"{",
"base",
"{",
"table",
":",
"table",
",",
"ctx",
":",
"ctx",
",",
"resultch",
":",
"make",
... | // NewEnableTable creates a new EnableTable request that will enable the
// given table in HBase. For use by the admin client. | [
"NewEnableTable",
"creates",
"a",
"new",
"EnableTable",
"request",
"that",
"will",
"enable",
"the",
"given",
"table",
"in",
"HBase",
".",
"For",
"use",
"by",
"the",
"admin",
"client",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/enable.go#L22-L30 |
30,001 | tsuna/gohbase | hrpc/mutate.go | TTL | func TTL(t time.Duration) func(Call) error {
return func(o Call) error {
m, ok := o.(*Mutate)
if !ok {
return errors.New("'TTL' option can only be used with mutation queries")
}
buf := make([]byte, 8)
binary.BigEndian.PutUint64(buf, uint64(t.Nanoseconds()/1e6))
m.ttl = buf
return nil
}
} | go | func TTL(t time.Duration) func(Call) error {
return func(o Call) error {
m, ok := o.(*Mutate)
if !ok {
return errors.New("'TTL' option can only be used with mutation queries")
}
buf := make([]byte, 8)
binary.BigEndian.PutUint64(buf, uint64(t.Nanoseconds()/1e6))
m.ttl = buf
return nil
}
} | [
"func",
"TTL",
"(",
"t",
"time",
".",
"Duration",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"o",
"Call",
")",
"error",
"{",
"m",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"Mutate",
")",
"\n",
"if",
"!",
"ok",
"{",
"return... | // TTL sets a time-to-live for mutation queries.
// The value will be in millisecond resolution. | [
"TTL",
"sets",
"a",
"time",
"-",
"to",
"-",
"live",
"for",
"mutation",
"queries",
".",
"The",
"value",
"will",
"be",
"in",
"millisecond",
"resolution",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L68-L81 |
30,002 | tsuna/gohbase | hrpc/mutate.go | Timestamp | func Timestamp(ts time.Time) func(Call) error {
return func(o Call) error {
m, ok := o.(*Mutate)
if !ok {
return errors.New("'Timestamp' option can only be used with mutation queries")
}
m.timestamp = uint64(ts.UnixNano() / 1e6)
return nil
}
} | go | func Timestamp(ts time.Time) func(Call) error {
return func(o Call) error {
m, ok := o.(*Mutate)
if !ok {
return errors.New("'Timestamp' option can only be used with mutation queries")
}
m.timestamp = uint64(ts.UnixNano() / 1e6)
return nil
}
} | [
"func",
"Timestamp",
"(",
"ts",
"time",
".",
"Time",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"o",
"Call",
")",
"error",
"{",
"m",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"Mutate",
")",
"\n",
"if",
"!",
"ok",
"{",
"ret... | // Timestamp sets timestamp for mutation queries.
// The time object passed will be rounded to a millisecond resolution, as by default,
// if no timestamp is provided, HBase sets it to current time in milliseconds.
// In order to have custom time precision, use TimestampUint64 call option for
// mutation requests and c... | [
"Timestamp",
"sets",
"timestamp",
"for",
"mutation",
"queries",
".",
"The",
"time",
"object",
"passed",
"will",
"be",
"rounded",
"to",
"a",
"millisecond",
"resolution",
"as",
"by",
"default",
"if",
"no",
"timestamp",
"is",
"provided",
"HBase",
"sets",
"it",
... | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L88-L97 |
30,003 | tsuna/gohbase | hrpc/mutate.go | TimestampUint64 | func TimestampUint64(ts uint64) func(Call) error {
return func(o Call) error {
m, ok := o.(*Mutate)
if !ok {
return errors.New("'TimestampUint64' option can only be used with mutation queries")
}
m.timestamp = ts
return nil
}
} | go | func TimestampUint64(ts uint64) func(Call) error {
return func(o Call) error {
m, ok := o.(*Mutate)
if !ok {
return errors.New("'TimestampUint64' option can only be used with mutation queries")
}
m.timestamp = ts
return nil
}
} | [
"func",
"TimestampUint64",
"(",
"ts",
"uint64",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"o",
"Call",
")",
"error",
"{",
"m",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"Mutate",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"... | // TimestampUint64 sets timestamp for mutation queries. | [
"TimestampUint64",
"sets",
"timestamp",
"for",
"mutation",
"queries",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L100-L109 |
30,004 | tsuna/gohbase | hrpc/mutate.go | Durability | func Durability(d DurabilityType) func(Call) error {
return func(o Call) error {
m, ok := o.(*Mutate)
if !ok {
return errors.New("'Durability' option can only be used with mutation queries")
}
if d < UseDefault || d > FsyncWal {
return errors.New("invalid durability value")
}
m.durability = d
retur... | go | func Durability(d DurabilityType) func(Call) error {
return func(o Call) error {
m, ok := o.(*Mutate)
if !ok {
return errors.New("'Durability' option can only be used with mutation queries")
}
if d < UseDefault || d > FsyncWal {
return errors.New("invalid durability value")
}
m.durability = d
retur... | [
"func",
"Durability",
"(",
"d",
"DurabilityType",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"o",
"Call",
")",
"error",
"{",
"m",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"Mutate",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
... | // Durability sets durability for mutation queries. | [
"Durability",
"sets",
"durability",
"for",
"mutation",
"queries",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L112-L124 |
30,005 | tsuna/gohbase | hrpc/mutate.go | baseMutate | func baseMutate(ctx context.Context, table, key []byte, values map[string]map[string][]byte,
options ...func(Call) error) (*Mutate, error) {
m := &Mutate{
base: base{
table: table,
key: key,
ctx: ctx,
resultch: make(chan RPCResult, 1),
},
values: values,
timestamp: MaxTimestamp,
}... | go | func baseMutate(ctx context.Context, table, key []byte, values map[string]map[string][]byte,
options ...func(Call) error) (*Mutate, error) {
m := &Mutate{
base: base{
table: table,
key: key,
ctx: ctx,
resultch: make(chan RPCResult, 1),
},
values: values,
timestamp: MaxTimestamp,
}... | [
"func",
"baseMutate",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
",",
"key",
"[",
"]",
"byte",
",",
"values",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error"... | // baseMutate returns a Mutate struct without the mutationType filled in. | [
"baseMutate",
"returns",
"a",
"Mutate",
"struct",
"without",
"the",
"mutationType",
"filled",
"in",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L144-L161 |
30,006 | tsuna/gohbase | hrpc/mutate.go | NewPutStr | func NewPutStr(ctx context.Context, table, key string,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
return NewPut(ctx, []byte(table), []byte(key), values, options...)
} | go | func NewPutStr(ctx context.Context, table, key string,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
return NewPut(ctx, []byte(table), []byte(key), values, options...)
} | [
"func",
"NewPutStr",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
",",
"key",
"string",
",",
"values",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(... | // NewPutStr is just like NewPut but takes table and key as strings. | [
"NewPutStr",
"is",
"just",
"like",
"NewPut",
"but",
"takes",
"table",
"and",
"key",
"as",
"strings",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L176-L179 |
30,007 | tsuna/gohbase | hrpc/mutate.go | NewDelStr | func NewDelStr(ctx context.Context, table, key string,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
return NewDel(ctx, []byte(table), []byte(key), values, options...)
} | go | func NewDelStr(ctx context.Context, table, key string,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
return NewDel(ctx, []byte(table), []byte(key), values, options...)
} | [
"func",
"NewDelStr",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
",",
"key",
"string",
",",
"values",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(... | // NewDelStr is just like NewDel but takes table and key as strings. | [
"NewDelStr",
"is",
"just",
"like",
"NewDel",
"but",
"takes",
"table",
"and",
"key",
"as",
"strings",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L223-L226 |
30,008 | tsuna/gohbase | hrpc/mutate.go | NewAppStr | func NewAppStr(ctx context.Context, table, key string,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
return NewApp(ctx, []byte(table), []byte(key), values, options...)
} | go | func NewAppStr(ctx context.Context, table, key string,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
return NewApp(ctx, []byte(table), []byte(key), values, options...)
} | [
"func",
"NewAppStr",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
",",
"key",
"string",
",",
"values",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(... | // NewAppStr is just like NewApp but takes table and key as strings. | [
"NewAppStr",
"is",
"just",
"like",
"NewApp",
"but",
"takes",
"table",
"and",
"key",
"as",
"strings",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L242-L245 |
30,009 | tsuna/gohbase | hrpc/mutate.go | NewIncSingle | func NewIncSingle(ctx context.Context, table, key []byte, family, qualifier string,
amount int64, options ...func(Call) error) (*Mutate, error) {
buf := make([]byte, 8)
binary.BigEndian.PutUint64(buf, uint64(amount))
value := map[string]map[string][]byte{family: map[string][]byte{qualifier: buf}}
return NewInc(ctx... | go | func NewIncSingle(ctx context.Context, table, key []byte, family, qualifier string,
amount int64, options ...func(Call) error) (*Mutate, error) {
buf := make([]byte, 8)
binary.BigEndian.PutUint64(buf, uint64(amount))
value := map[string]map[string][]byte{family: map[string][]byte{qualifier: buf}}
return NewInc(ctx... | [
"func",
"NewIncSingle",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
",",
"key",
"[",
"]",
"byte",
",",
"family",
",",
"qualifier",
"string",
",",
"amount",
"int64",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(",
"*",
"Mu... | // NewIncSingle creates a new Mutation request that will increment the given value
// by amount in HBase under the given table, key, family and qualifier. | [
"NewIncSingle",
"creates",
"a",
"new",
"Mutation",
"request",
"that",
"will",
"increment",
"the",
"given",
"value",
"by",
"amount",
"in",
"HBase",
"under",
"the",
"given",
"table",
"key",
"family",
"and",
"qualifier",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L249-L255 |
30,010 | tsuna/gohbase | hrpc/mutate.go | NewIncStrSingle | func NewIncStrSingle(ctx context.Context, table, key, family, qualifier string,
amount int64, options ...func(Call) error) (*Mutate, error) {
return NewIncSingle(ctx, []byte(table), []byte(key), family, qualifier, amount, options...)
} | go | func NewIncStrSingle(ctx context.Context, table, key, family, qualifier string,
amount int64, options ...func(Call) error) (*Mutate, error) {
return NewIncSingle(ctx, []byte(table), []byte(key), family, qualifier, amount, options...)
} | [
"func",
"NewIncStrSingle",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
",",
"key",
",",
"family",
",",
"qualifier",
"string",
",",
"amount",
"int64",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(",
"*",
"Mutate",
",",
"erro... | // NewIncStrSingle is just like NewIncSingle but takes table and key as strings. | [
"NewIncStrSingle",
"is",
"just",
"like",
"NewIncSingle",
"but",
"takes",
"table",
"and",
"key",
"as",
"strings",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L258-L261 |
30,011 | tsuna/gohbase | hrpc/mutate.go | NewInc | func NewInc(ctx context.Context, table, key []byte,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
m, err := baseMutate(ctx, table, key, values, options...)
if err != nil {
return nil, err
}
m.mutationType = pb.MutationProto_INCREMENT
return m, nil
} | go | func NewInc(ctx context.Context, table, key []byte,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
m, err := baseMutate(ctx, table, key, values, options...)
if err != nil {
return nil, err
}
m.mutationType = pb.MutationProto_INCREMENT
return m, nil
} | [
"func",
"NewInc",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
",",
"key",
"[",
"]",
"byte",
",",
"values",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
... | // NewInc creates a new Mutation request that will increment the given values
// in HBase under the given table and key. | [
"NewInc",
"creates",
"a",
"new",
"Mutation",
"request",
"that",
"will",
"increment",
"the",
"given",
"values",
"in",
"HBase",
"under",
"the",
"given",
"table",
"and",
"key",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L265-L273 |
30,012 | tsuna/gohbase | hrpc/mutate.go | NewIncStr | func NewIncStr(ctx context.Context, table, key string,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
return NewInc(ctx, []byte(table), []byte(key), values, options...)
} | go | func NewIncStr(ctx context.Context, table, key string,
values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
return NewInc(ctx, []byte(table), []byte(key), values, options...)
} | [
"func",
"NewIncStr",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
",",
"key",
"string",
",",
"values",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(... | // NewIncStr is just like NewInc but takes table and key as strings. | [
"NewIncStr",
"is",
"just",
"like",
"NewInc",
"but",
"takes",
"table",
"and",
"key",
"as",
"strings",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L276-L279 |
30,013 | tsuna/gohbase | hrpc/mutate.go | DeserializeCellBlocks | func (m *Mutate) DeserializeCellBlocks(pm proto.Message, b []byte) (uint32, error) {
resp := pm.(*pb.MutateResponse)
if resp.Result == nil {
// TODO: is this possible?
return 0, nil
}
cells, read, err := deserializeCellBlocks(b, uint32(resp.Result.GetAssociatedCellCount()))
if err != nil {
return 0, err
}
... | go | func (m *Mutate) DeserializeCellBlocks(pm proto.Message, b []byte) (uint32, error) {
resp := pm.(*pb.MutateResponse)
if resp.Result == nil {
// TODO: is this possible?
return 0, nil
}
cells, read, err := deserializeCellBlocks(b, uint32(resp.Result.GetAssociatedCellCount()))
if err != nil {
return 0, err
}
... | [
"func",
"(",
"m",
"*",
"Mutate",
")",
"DeserializeCellBlocks",
"(",
"pm",
"proto",
".",
"Message",
",",
"b",
"[",
"]",
"byte",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"resp",
":=",
"pm",
".",
"(",
"*",
"pb",
".",
"MutateResponse",
")",
"\n",
... | // DeserializeCellBlocks deserializes mutate result from cell blocks | [
"DeserializeCellBlocks",
"deserializes",
"mutate",
"result",
"from",
"cell",
"blocks"
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/mutate.go#L385-L397 |
30,014 | tsuna/gohbase | region/new.go | NewClient | func NewClient(ctx context.Context, addr string, ctype ClientType,
queueSize int, flushInterval time.Duration, effectiveUser string,
readTimeout time.Duration) (hrpc.RegionClient, error) {
var d net.Dialer
conn, err := d.DialContext(ctx, "tcp", addr)
if err != nil {
return nil, fmt.Errorf("failed to connect to t... | go | func NewClient(ctx context.Context, addr string, ctype ClientType,
queueSize int, flushInterval time.Duration, effectiveUser string,
readTimeout time.Duration) (hrpc.RegionClient, error) {
var d net.Dialer
conn, err := d.DialContext(ctx, "tcp", addr)
if err != nil {
return nil, fmt.Errorf("failed to connect to t... | [
"func",
"NewClient",
"(",
"ctx",
"context",
".",
"Context",
",",
"addr",
"string",
",",
"ctype",
"ClientType",
",",
"queueSize",
"int",
",",
"flushInterval",
"time",
".",
"Duration",
",",
"effectiveUser",
"string",
",",
"readTimeout",
"time",
".",
"Duration",
... | // NewClient creates a new RegionClient. | [
"NewClient",
"creates",
"a",
"new",
"RegionClient",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/new.go#L20-L56 |
30,015 | tsuna/gohbase | hrpc/query.go | newBaseQuery | func newBaseQuery() baseQuery {
return baseQuery{
storeLimit: DefaultMaxResultsPerColumnFamily,
fromTimestamp: MinTimestamp,
toTimestamp: MaxTimestamp,
maxVersions: DefaultMaxVersions,
}
} | go | func newBaseQuery() baseQuery {
return baseQuery{
storeLimit: DefaultMaxResultsPerColumnFamily,
fromTimestamp: MinTimestamp,
toTimestamp: MaxTimestamp,
maxVersions: DefaultMaxVersions,
}
} | [
"func",
"newBaseQuery",
"(",
")",
"baseQuery",
"{",
"return",
"baseQuery",
"{",
"storeLimit",
":",
"DefaultMaxResultsPerColumnFamily",
",",
"fromTimestamp",
":",
"MinTimestamp",
",",
"toTimestamp",
":",
"MaxTimestamp",
",",
"maxVersions",
":",
"DefaultMaxVersions",
",... | // newBaseQuery return baseQuery with all default values | [
"newBaseQuery",
"return",
"baseQuery",
"with",
"all",
"default",
"values"
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/query.go#L29-L36 |
30,016 | tsuna/gohbase | hrpc/query.go | Families | func Families(f map[string][]string) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
c.setFamilies(f)
return nil
}
return errors.New("'Families' option can only be used with Get or Scan request")
}
} | go | func Families(f map[string][]string) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
c.setFamilies(f)
return nil
}
return errors.New("'Families' option can only be used with Get or Scan request")
}
} | [
"func",
"Families",
"(",
"f",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"hc",
"Call",
")",
"error",
"{",
"if",
"c",
",",
"ok",
":=",
"hc",
".",
"(",
"hasQueryOptions",
")",
... | // Families option adds families constraint to a Scan or Get request. | [
"Families",
"option",
"adds",
"families",
"constraint",
"to",
"a",
"Scan",
"or",
"Get",
"request",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/query.go#L59-L67 |
30,017 | tsuna/gohbase | hrpc/query.go | Filters | func Filters(f filter.Filter) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
pbF, err := f.ConstructPBFilter()
if err != nil {
return err
}
c.setFilter(pbF)
return nil
}
return errors.New("'Filters' option can only be used with Get or Scan request")
}
} | go | func Filters(f filter.Filter) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
pbF, err := f.ConstructPBFilter()
if err != nil {
return err
}
c.setFilter(pbF)
return nil
}
return errors.New("'Filters' option can only be used with Get or Scan request")
}
} | [
"func",
"Filters",
"(",
"f",
"filter",
".",
"Filter",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"hc",
"Call",
")",
"error",
"{",
"if",
"c",
",",
"ok",
":=",
"hc",
".",
"(",
"hasQueryOptions",
")",
";",
"ok",
"{",
"pbF",
... | // Filters option adds filters constraint to a Scan or Get request. | [
"Filters",
"option",
"adds",
"filters",
"constraint",
"to",
"a",
"Scan",
"or",
"Get",
"request",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/query.go#L70-L82 |
30,018 | tsuna/gohbase | hrpc/query.go | MaxVersions | func MaxVersions(versions uint32) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
if versions > math.MaxInt32 {
return errors.New("'MaxVersions' exceeds supported number of versions")
}
c.setMaxVersions(versions)
return nil
}
return errors.New("'MaxVersions'... | go | func MaxVersions(versions uint32) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
if versions > math.MaxInt32 {
return errors.New("'MaxVersions' exceeds supported number of versions")
}
c.setMaxVersions(versions)
return nil
}
return errors.New("'MaxVersions'... | [
"func",
"MaxVersions",
"(",
"versions",
"uint32",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"hc",
"Call",
")",
"error",
"{",
"if",
"c",
",",
"ok",
":=",
"hc",
".",
"(",
"hasQueryOptions",
")",
";",
"ok",
"{",
"if",
"versio... | // MaxVersions is used as a parameter for request creation.
// Adds MaxVersions constraint to a request. | [
"MaxVersions",
"is",
"used",
"as",
"a",
"parameter",
"for",
"request",
"creation",
".",
"Adds",
"MaxVersions",
"constraint",
"to",
"a",
"request",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/query.go#L110-L121 |
30,019 | tsuna/gohbase | hrpc/query.go | MaxResultsPerColumnFamily | func MaxResultsPerColumnFamily(maxresults uint32) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
if maxresults > math.MaxInt32 {
return errors.New(
"'MaxResultsPerColumnFamily' exceeds supported number of value results")
}
c.setMaxResultsPerColumnFamily(maxre... | go | func MaxResultsPerColumnFamily(maxresults uint32) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
if maxresults > math.MaxInt32 {
return errors.New(
"'MaxResultsPerColumnFamily' exceeds supported number of value results")
}
c.setMaxResultsPerColumnFamily(maxre... | [
"func",
"MaxResultsPerColumnFamily",
"(",
"maxresults",
"uint32",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"hc",
"Call",
")",
"error",
"{",
"if",
"c",
",",
"ok",
":=",
"hc",
".",
"(",
"hasQueryOptions",
")",
";",
"ok",
"{",
... | // MaxResultsPerColumnFamily is an option for Get or Scan requests that sets the maximum
// number of cells returned per column family in a row. | [
"MaxResultsPerColumnFamily",
"is",
"an",
"option",
"for",
"Get",
"or",
"Scan",
"requests",
"that",
"sets",
"the",
"maximum",
"number",
"of",
"cells",
"returned",
"per",
"column",
"family",
"in",
"a",
"row",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/query.go#L125-L138 |
30,020 | tsuna/gohbase | hrpc/query.go | ResultOffset | func ResultOffset(offset uint32) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
if offset > math.MaxInt32 {
return errors.New("'ResultOffset' exceeds supported offset value")
}
c.setResultOffset(offset)
return nil
}
return errors.New("'ResultOffset' option ... | go | func ResultOffset(offset uint32) func(Call) error {
return func(hc Call) error {
if c, ok := hc.(hasQueryOptions); ok {
if offset > math.MaxInt32 {
return errors.New("'ResultOffset' exceeds supported offset value")
}
c.setResultOffset(offset)
return nil
}
return errors.New("'ResultOffset' option ... | [
"func",
"ResultOffset",
"(",
"offset",
"uint32",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"hc",
"Call",
")",
"error",
"{",
"if",
"c",
",",
"ok",
":=",
"hc",
".",
"(",
"hasQueryOptions",
")",
";",
"ok",
"{",
"if",
"offset"... | // ResultOffset is a option for Scan or Get requests that sets the offset for cells
// within a column family. | [
"ResultOffset",
"is",
"a",
"option",
"for",
"Scan",
"or",
"Get",
"requests",
"that",
"sets",
"the",
"offset",
"for",
"cells",
"within",
"a",
"column",
"family",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/query.go#L142-L153 |
30,021 | tsuna/gohbase | hrpc/status.go | NewClusterStatus | func NewClusterStatus() *ClusterStatus {
return &ClusterStatus{
base{
ctx: context.Background(),
table: []byte{},
resultch: make(chan RPCResult, 1),
},
}
} | go | func NewClusterStatus() *ClusterStatus {
return &ClusterStatus{
base{
ctx: context.Background(),
table: []byte{},
resultch: make(chan RPCResult, 1),
},
}
} | [
"func",
"NewClusterStatus",
"(",
")",
"*",
"ClusterStatus",
"{",
"return",
"&",
"ClusterStatus",
"{",
"base",
"{",
"ctx",
":",
"context",
".",
"Background",
"(",
")",
",",
"table",
":",
"[",
"]",
"byte",
"{",
"}",
",",
"resultch",
":",
"make",
"(",
"... | // NewClusterStatus creates a new ClusterStatusStruct with default fields | [
"NewClusterStatus",
"creates",
"a",
"new",
"ClusterStatusStruct",
"with",
"default",
"fields"
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/status.go#L16-L24 |
30,022 | tsuna/gohbase | hrpc/scan.go | baseScan | func baseScan(ctx context.Context, table []byte,
options ...func(Call) error) (*Scan, error) {
s := &Scan{
base: base{
table: table,
ctx: ctx,
resultch: make(chan RPCResult, 1),
},
baseQuery: newBaseQuery(),
scannerID: math.MaxUint64,
maxResultSize: DefaultMaxResultSize,
numberOfR... | go | func baseScan(ctx context.Context, table []byte,
options ...func(Call) error) (*Scan, error) {
s := &Scan{
base: base{
table: table,
ctx: ctx,
resultch: make(chan RPCResult, 1),
},
baseQuery: newBaseQuery(),
scannerID: math.MaxUint64,
maxResultSize: DefaultMaxResultSize,
numberOfR... | [
"func",
"baseScan",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
"[",
"]",
"byte",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(",
"*",
"Scan",
",",
"error",
")",
"{",
"s",
":=",
"&",
"Scan",
"{",
"base",
":",
"base",
... | // baseScan returns a Scan struct with default values set. | [
"baseScan",
"returns",
"a",
"Scan",
"struct",
"with",
"default",
"values",
"set",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L74-L93 |
30,023 | tsuna/gohbase | hrpc/scan.go | NewScan | func NewScan(ctx context.Context, table []byte, options ...func(Call) error) (*Scan, error) {
return baseScan(ctx, table, options...)
} | go | func NewScan(ctx context.Context, table []byte, options ...func(Call) error) (*Scan, error) {
return baseScan(ctx, table, options...)
} | [
"func",
"NewScan",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
"[",
"]",
"byte",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(",
"*",
"Scan",
",",
"error",
")",
"{",
"return",
"baseScan",
"(",
"ctx",
",",
"table",
",",
... | // NewScan creates a scanner for the given table. | [
"NewScan",
"creates",
"a",
"scanner",
"for",
"the",
"given",
"table",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L105-L107 |
30,024 | tsuna/gohbase | hrpc/scan.go | NewScanStr | func NewScanStr(ctx context.Context, table string, options ...func(Call) error) (*Scan, error) {
return NewScan(ctx, []byte(table), options...)
} | go | func NewScanStr(ctx context.Context, table string, options ...func(Call) error) (*Scan, error) {
return NewScan(ctx, []byte(table), options...)
} | [
"func",
"NewScanStr",
"(",
"ctx",
"context",
".",
"Context",
",",
"table",
"string",
",",
"options",
"...",
"func",
"(",
"Call",
")",
"error",
")",
"(",
"*",
"Scan",
",",
"error",
")",
"{",
"return",
"NewScan",
"(",
"ctx",
",",
"[",
"]",
"byte",
"(... | // NewScanStr creates a scanner for the given table. | [
"NewScanStr",
"creates",
"a",
"scanner",
"for",
"the",
"given",
"table",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L125-L127 |
30,025 | tsuna/gohbase | hrpc/scan.go | ToProto | func (s *Scan) ToProto() proto.Message {
scan := &pb.ScanRequest{
Region: s.regionSpecifier(),
CloseScanner: &s.closeScanner,
NumberOfRows: &s.numberOfRows,
// tell server that we can process results that are only part of a row
ClientHandlesPartials: proto.Bool(true),
// tell server that we "handle" ... | go | func (s *Scan) ToProto() proto.Message {
scan := &pb.ScanRequest{
Region: s.regionSpecifier(),
CloseScanner: &s.closeScanner,
NumberOfRows: &s.numberOfRows,
// tell server that we can process results that are only part of a row
ClientHandlesPartials: proto.Bool(true),
// tell server that we "handle" ... | [
"func",
"(",
"s",
"*",
"Scan",
")",
"ToProto",
"(",
")",
"proto",
".",
"Message",
"{",
"scan",
":=",
"&",
"pb",
".",
"ScanRequest",
"{",
"Region",
":",
"s",
".",
"regionSpecifier",
"(",
")",
",",
"CloseScanner",
":",
"&",
"s",
".",
"closeScanner",
... | // ToProto converts this Scan into a protobuf message | [
"ToProto",
"converts",
"this",
"Scan",
"into",
"a",
"protobuf",
"message"
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L174-L219 |
30,026 | tsuna/gohbase | hrpc/scan.go | DeserializeCellBlocks | func (s *Scan) DeserializeCellBlocks(m proto.Message, b []byte) (uint32, error) {
scanResp := m.(*pb.ScanResponse)
partials := scanResp.GetPartialFlagPerResult()
scanResp.Results = make([]*pb.Result, len(partials))
var readLen uint32
for i, numCells := range scanResp.GetCellsPerResult() {
cells, l, err := deseri... | go | func (s *Scan) DeserializeCellBlocks(m proto.Message, b []byte) (uint32, error) {
scanResp := m.(*pb.ScanResponse)
partials := scanResp.GetPartialFlagPerResult()
scanResp.Results = make([]*pb.Result, len(partials))
var readLen uint32
for i, numCells := range scanResp.GetCellsPerResult() {
cells, l, err := deseri... | [
"func",
"(",
"s",
"*",
"Scan",
")",
"DeserializeCellBlocks",
"(",
"m",
"proto",
".",
"Message",
",",
"b",
"[",
"]",
"byte",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"scanResp",
":=",
"m",
".",
"(",
"*",
"pb",
".",
"ScanResponse",
")",
"\n",
"p... | // DeserializeCellBlocks deserializes scan results from cell blocks | [
"DeserializeCellBlocks",
"deserializes",
"scan",
"results",
"from",
"cell",
"blocks"
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L228-L245 |
30,027 | tsuna/gohbase | hrpc/scan.go | ScannerID | func ScannerID(id uint64) func(Call) error {
return func(s Call) error {
scan, ok := s.(*Scan)
if !ok {
return errors.New("'ScannerID' option can only be used with Scan queries")
}
scan.scannerID = id
return nil
}
} | go | func ScannerID(id uint64) func(Call) error {
return func(s Call) error {
scan, ok := s.(*Scan)
if !ok {
return errors.New("'ScannerID' option can only be used with Scan queries")
}
scan.scannerID = id
return nil
}
} | [
"func",
"ScannerID",
"(",
"id",
"uint64",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"s",
"Call",
")",
"error",
"{",
"scan",
",",
"ok",
":=",
"s",
".",
"(",
"*",
"Scan",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"error... | // ScannerID is an option for scan requests.
// This is an internal option to fetch the next set of results for an ongoing scan. | [
"ScannerID",
"is",
"an",
"option",
"for",
"scan",
"requests",
".",
"This",
"is",
"an",
"internal",
"option",
"to",
"fetch",
"the",
"next",
"set",
"of",
"results",
"for",
"an",
"ongoing",
"scan",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L249-L258 |
30,028 | tsuna/gohbase | hrpc/scan.go | CloseScanner | func CloseScanner() func(Call) error {
return func(s Call) error {
scan, ok := s.(*Scan)
if !ok {
return errors.New("'Close' option can only be used with Scan queries")
}
scan.closeScanner = true
return nil
}
} | go | func CloseScanner() func(Call) error {
return func(s Call) error {
scan, ok := s.(*Scan)
if !ok {
return errors.New("'Close' option can only be used with Scan queries")
}
scan.closeScanner = true
return nil
}
} | [
"func",
"CloseScanner",
"(",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"s",
"Call",
")",
"error",
"{",
"scan",
",",
"ok",
":=",
"s",
".",
"(",
"*",
"Scan",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"errors",
".",
"New... | // CloseScanner is an option for scan requests.
// Closes scanner after the first result is returned. This is an internal option
// but could be useful if you know that your scan result fits into one response
// in order to save an extra request. | [
"CloseScanner",
"is",
"an",
"option",
"for",
"scan",
"requests",
".",
"Closes",
"scanner",
"after",
"the",
"first",
"result",
"is",
"returned",
".",
"This",
"is",
"an",
"internal",
"option",
"but",
"could",
"be",
"useful",
"if",
"you",
"know",
"that",
"you... | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L264-L273 |
30,029 | tsuna/gohbase | hrpc/scan.go | MaxResultSize | func MaxResultSize(n uint64) func(Call) error {
return func(g Call) error {
scan, ok := g.(*Scan)
if !ok {
return errors.New("'MaxResultSize' option can only be used with Scan queries")
}
if n == 0 {
return errors.New("'MaxResultSize' option must be greater than 0")
}
scan.maxResultSize = n
return ... | go | func MaxResultSize(n uint64) func(Call) error {
return func(g Call) error {
scan, ok := g.(*Scan)
if !ok {
return errors.New("'MaxResultSize' option can only be used with Scan queries")
}
if n == 0 {
return errors.New("'MaxResultSize' option must be greater than 0")
}
scan.maxResultSize = n
return ... | [
"func",
"MaxResultSize",
"(",
"n",
"uint64",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"g",
"Call",
")",
"error",
"{",
"scan",
",",
"ok",
":=",
"g",
".",
"(",
"*",
"Scan",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"er... | // MaxResultSize is an option for scan requests.
// Maximum number of bytes fetched when calling a scanner's next method.
// MaxResultSize takes priority over NumberOfRows. | [
"MaxResultSize",
"is",
"an",
"option",
"for",
"scan",
"requests",
".",
"Maximum",
"number",
"of",
"bytes",
"fetched",
"when",
"calling",
"a",
"scanner",
"s",
"next",
"method",
".",
"MaxResultSize",
"takes",
"priority",
"over",
"NumberOfRows",
"."
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L278-L290 |
30,030 | tsuna/gohbase | hrpc/scan.go | NumberOfRows | func NumberOfRows(n uint32) func(Call) error {
return func(g Call) error {
scan, ok := g.(*Scan)
if !ok {
return errors.New("'NumberOfRows' option can only be used with Scan queries")
}
scan.numberOfRows = n
return nil
}
} | go | func NumberOfRows(n uint32) func(Call) error {
return func(g Call) error {
scan, ok := g.(*Scan)
if !ok {
return errors.New("'NumberOfRows' option can only be used with Scan queries")
}
scan.numberOfRows = n
return nil
}
} | [
"func",
"NumberOfRows",
"(",
"n",
"uint32",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"g",
"Call",
")",
"error",
"{",
"scan",
",",
"ok",
":=",
"g",
".",
"(",
"*",
"Scan",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"err... | // NumberOfRows is an option for scan requests.
// Specifies how many rows are fetched with each request to regionserver.
// Should be > 0, avoid extremely low values such as 1 because a request
// to regionserver will be made for every row. | [
"NumberOfRows",
"is",
"an",
"option",
"for",
"scan",
"requests",
".",
"Specifies",
"how",
"many",
"rows",
"are",
"fetched",
"with",
"each",
"request",
"to",
"regionserver",
".",
"Should",
"be",
">",
"0",
"avoid",
"extremely",
"low",
"values",
"such",
"as",
... | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L296-L305 |
30,031 | tsuna/gohbase | hrpc/scan.go | Reversed | func Reversed() func(Call) error {
return func(g Call) error {
scan, ok := g.(*Scan)
if !ok {
return errors.New("'Reversed' option can only be used with Scan queries")
}
scan.reversed = true
return nil
}
} | go | func Reversed() func(Call) error {
return func(g Call) error {
scan, ok := g.(*Scan)
if !ok {
return errors.New("'Reversed' option can only be used with Scan queries")
}
scan.reversed = true
return nil
}
} | [
"func",
"Reversed",
"(",
")",
"func",
"(",
"Call",
")",
"error",
"{",
"return",
"func",
"(",
"g",
"Call",
")",
"error",
"{",
"scan",
",",
"ok",
":=",
"g",
".",
"(",
"*",
"Scan",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"errors",
".",
"New",
... | // Reversed is a Scan-only option which allows you to scan in reverse key order
// To use it the startKey would be greater than the end key | [
"Reversed",
"is",
"a",
"Scan",
"-",
"only",
"option",
"which",
"allows",
"you",
"to",
"scan",
"in",
"reverse",
"key",
"order",
"To",
"use",
"it",
"the",
"startKey",
"would",
"be",
"greater",
"than",
"the",
"end",
"key"
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/scan.go#L324-L333 |
30,032 | tsuna/gohbase | admin_client.go | ClusterStatus | func (c *client) ClusterStatus() (*pb.ClusterStatus, error) {
pbmsg, err := c.SendRPC(hrpc.NewClusterStatus())
if err != nil {
return nil, err
}
r, ok := pbmsg.(*pb.GetClusterStatusResponse)
if !ok {
return nil, fmt.Errorf("sendRPC returned not a ClusterStatusResponse")
}
return r.GetClusterStatus(), nil
} | go | func (c *client) ClusterStatus() (*pb.ClusterStatus, error) {
pbmsg, err := c.SendRPC(hrpc.NewClusterStatus())
if err != nil {
return nil, err
}
r, ok := pbmsg.(*pb.GetClusterStatusResponse)
if !ok {
return nil, fmt.Errorf("sendRPC returned not a ClusterStatusResponse")
}
return r.GetClusterStatus(), nil
} | [
"func",
"(",
"c",
"*",
"client",
")",
"ClusterStatus",
"(",
")",
"(",
"*",
"pb",
".",
"ClusterStatus",
",",
"error",
")",
"{",
"pbmsg",
",",
"err",
":=",
"c",
".",
"SendRPC",
"(",
"hrpc",
".",
"NewClusterStatus",
"(",
")",
")",
"\n",
"if",
"err",
... | //Get the status of the cluster | [
"Get",
"the",
"status",
"of",
"the",
"cluster"
] | 24ffed0537aae38093b39c12781e4c09f8cb0029 | https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/admin_client.go#L58-L70 |
30,033 | y0ssar1an/q | args.go | argWidth | func argWidth(arg string) int {
// Strip zero-width characters.
replacer := strings.NewReplacer(
"\n", "",
"\t", "",
"\r", "",
"\f", "",
"\v", "",
string(bold), "",
string(yellow), "",
string(cyan), "",
string(endColor), "",
)
s := replacer.Replace(arg)
return utf8.RuneCountInString(s)
} | go | func argWidth(arg string) int {
// Strip zero-width characters.
replacer := strings.NewReplacer(
"\n", "",
"\t", "",
"\r", "",
"\f", "",
"\v", "",
string(bold), "",
string(yellow), "",
string(cyan), "",
string(endColor), "",
)
s := replacer.Replace(arg)
return utf8.RuneCountInString(s)
} | [
"func",
"argWidth",
"(",
"arg",
"string",
")",
"int",
"{",
"// Strip zero-width characters.",
"replacer",
":=",
"strings",
".",
"NewReplacer",
"(",
"\"",
"\\n",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\\t",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\\r",
"\"",
","... | // argWidth returns the number of characters that will be seen when the given
// argument is printed at the terminal. | [
"argWidth",
"returns",
"the",
"number",
"of",
"characters",
"that",
"will",
"be",
"seen",
"when",
"the",
"given",
"argument",
"is",
"printed",
"at",
"the",
"terminal",
"."
] | befa58832e0b7483b4246ec6b31c007e0a358353 | https://github.com/y0ssar1an/q/blob/befa58832e0b7483b4246ec6b31c007e0a358353/args.go#L90-L105 |
30,034 | y0ssar1an/q | args.go | colorize | func colorize(text string, c color) string {
return string(c) + text + string(endColor)
} | go | func colorize(text string, c color) string {
return string(c) + text + string(endColor)
} | [
"func",
"colorize",
"(",
"text",
"string",
",",
"c",
"color",
")",
"string",
"{",
"return",
"string",
"(",
"c",
")",
"+",
"text",
"+",
"string",
"(",
"endColor",
")",
"\n",
"}"
] | // colorize returns the given text encapsulated in ANSI escape codes that
// give the text color in the terminal. | [
"colorize",
"returns",
"the",
"given",
"text",
"encapsulated",
"in",
"ANSI",
"escape",
"codes",
"that",
"give",
"the",
"text",
"color",
"in",
"the",
"terminal",
"."
] | befa58832e0b7483b4246ec6b31c007e0a358353 | https://github.com/y0ssar1an/q/blob/befa58832e0b7483b4246ec6b31c007e0a358353/args.go#L109-L111 |
30,035 | y0ssar1an/q | args.go | formatArgs | func formatArgs(args ...interface{}) []string {
formatted := make([]string, 0, len(args))
for _, a := range args {
s := colorize(pretty.Sprint(a), cyan)
formatted = append(formatted, s)
}
return formatted
} | go | func formatArgs(args ...interface{}) []string {
formatted := make([]string, 0, len(args))
for _, a := range args {
s := colorize(pretty.Sprint(a), cyan)
formatted = append(formatted, s)
}
return formatted
} | [
"func",
"formatArgs",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"[",
"]",
"string",
"{",
"formatted",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"args",
")",
")",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"args",
"... | // formatArgs converts the given args to pretty-printed, colorized strings. | [
"formatArgs",
"converts",
"the",
"given",
"args",
"to",
"pretty",
"-",
"printed",
"colorized",
"strings",
"."
] | befa58832e0b7483b4246ec6b31c007e0a358353 | https://github.com/y0ssar1an/q/blob/befa58832e0b7483b4246ec6b31c007e0a358353/args.go#L127-L134 |
30,036 | y0ssar1an/q | logger.go | flush | func (l *logger) flush() (err error) {
path := filepath.Join(os.TempDir(), "q")
f, err := os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
return fmt.Errorf("failed to open %q: %v", path, err)
}
defer func() {
if cerr := f.Close(); err == nil {
err = cerr
}
l.lastWrite = time... | go | func (l *logger) flush() (err error) {
path := filepath.Join(os.TempDir(), "q")
f, err := os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
return fmt.Errorf("failed to open %q: %v", path, err)
}
defer func() {
if cerr := f.Close(); err == nil {
err = cerr
}
l.lastWrite = time... | [
"func",
"(",
"l",
"*",
"logger",
")",
"flush",
"(",
")",
"(",
"err",
"error",
")",
"{",
"path",
":=",
"filepath",
".",
"Join",
"(",
"os",
".",
"TempDir",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"f",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",... | // flush writes the logger's buffer to disk. | [
"flush",
"writes",
"the",
"logger",
"s",
"buffer",
"to",
"disk",
"."
] | befa58832e0b7483b4246ec6b31c007e0a358353 | https://github.com/y0ssar1an/q/blob/befa58832e0b7483b4246ec6b31c007e0a358353/logger.go#L74-L94 |
30,037 | xyproto/permissions2 | permissions.go | AddAdminPath | func (perm *Permissions) AddAdminPath(prefix string) {
perm.adminPathPrefixes = append(perm.adminPathPrefixes, prefix)
} | go | func (perm *Permissions) AddAdminPath(prefix string) {
perm.adminPathPrefixes = append(perm.adminPathPrefixes, prefix)
} | [
"func",
"(",
"perm",
"*",
"Permissions",
")",
"AddAdminPath",
"(",
"prefix",
"string",
")",
"{",
"perm",
".",
"adminPathPrefixes",
"=",
"append",
"(",
"perm",
".",
"adminPathPrefixes",
",",
"prefix",
")",
"\n",
"}"
] | // AddAdminPath registers a path prefix for URLs that shall only be reached by logged in administrators | [
"AddAdminPath",
"registers",
"a",
"path",
"prefix",
"for",
"URLs",
"that",
"shall",
"only",
"be",
"reached",
"by",
"logged",
"in",
"administrators"
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/permissions.go#L92-L94 |
30,038 | xyproto/permissions2 | permissions.go | AddUserPath | func (perm *Permissions) AddUserPath(prefix string) {
perm.userPathPrefixes = append(perm.userPathPrefixes, prefix)
} | go | func (perm *Permissions) AddUserPath(prefix string) {
perm.userPathPrefixes = append(perm.userPathPrefixes, prefix)
} | [
"func",
"(",
"perm",
"*",
"Permissions",
")",
"AddUserPath",
"(",
"prefix",
"string",
")",
"{",
"perm",
".",
"userPathPrefixes",
"=",
"append",
"(",
"perm",
".",
"userPathPrefixes",
",",
"prefix",
")",
"\n",
"}"
] | // AddUserPath registers a path prefix for URLs that shall only be reached by logged in users | [
"AddUserPath",
"registers",
"a",
"path",
"prefix",
"for",
"URLs",
"that",
"shall",
"only",
"be",
"reached",
"by",
"logged",
"in",
"users"
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/permissions.go#L97-L99 |
30,039 | xyproto/permissions2 | permissions.go | AddPublicPath | func (perm *Permissions) AddPublicPath(prefix string) {
perm.publicPathPrefixes = append(perm.publicPathPrefixes, prefix)
} | go | func (perm *Permissions) AddPublicPath(prefix string) {
perm.publicPathPrefixes = append(perm.publicPathPrefixes, prefix)
} | [
"func",
"(",
"perm",
"*",
"Permissions",
")",
"AddPublicPath",
"(",
"prefix",
"string",
")",
"{",
"perm",
".",
"publicPathPrefixes",
"=",
"append",
"(",
"perm",
".",
"publicPathPrefixes",
",",
"prefix",
")",
"\n",
"}"
] | // AddPublicPath registers a path prefix for URLs that can be reached by anyone | [
"AddPublicPath",
"registers",
"a",
"path",
"prefix",
"for",
"URLs",
"that",
"can",
"be",
"reached",
"by",
"anyone"
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/permissions.go#L102-L104 |
30,040 | xyproto/permissions2 | permissions.go | PermissionDenied | func PermissionDenied(w http.ResponseWriter, req *http.Request) {
http.Error(w, "Permission denied.", http.StatusForbidden)
} | go | func PermissionDenied(w http.ResponseWriter, req *http.Request) {
http.Error(w, "Permission denied.", http.StatusForbidden)
} | [
"func",
"PermissionDenied",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"\"",
"\"",
",",
"http",
".",
"StatusForbidden",
")",
"\n",
"}"
] | // The default "permission denied" http handler. | [
"The",
"default",
"permission",
"denied",
"http",
"handler",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/permissions.go#L122-L124 |
30,041 | xyproto/permissions2 | hashing.go | hashBcrypt | func hashBcrypt(password string) []byte {
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
panic("Permissions: bcrypt password hashing unsuccessful")
}
return hash
} | go | func hashBcrypt(password string) []byte {
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
panic("Permissions: bcrypt password hashing unsuccessful")
}
return hash
} | [
"func",
"hashBcrypt",
"(",
"password",
"string",
")",
"[",
"]",
"byte",
"{",
"hash",
",",
"err",
":=",
"bcrypt",
".",
"GenerateFromPassword",
"(",
"[",
"]",
"byte",
"(",
"password",
")",
",",
"bcrypt",
".",
"DefaultCost",
")",
"\n",
"if",
"err",
"!=",
... | // Hash the password with bcrypt | [
"Hash",
"the",
"password",
"with",
"bcrypt"
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/hashing.go#L20-L26 |
30,042 | xyproto/permissions2 | hashing.go | correctBcrypt | func correctBcrypt(hash []byte, password string) bool {
// prevents timing attack
return bcrypt.CompareHashAndPassword(hash, []byte(password)) == nil
} | go | func correctBcrypt(hash []byte, password string) bool {
// prevents timing attack
return bcrypt.CompareHashAndPassword(hash, []byte(password)) == nil
} | [
"func",
"correctBcrypt",
"(",
"hash",
"[",
"]",
"byte",
",",
"password",
"string",
")",
"bool",
"{",
"// prevents timing attack",
"return",
"bcrypt",
".",
"CompareHashAndPassword",
"(",
"hash",
",",
"[",
"]",
"byte",
"(",
"password",
")",
")",
"==",
"nil",
... | // Check if a given password is correct, for a given bcrypt hash | [
"Check",
"if",
"a",
"given",
"password",
"is",
"correct",
"for",
"a",
"given",
"bcrypt",
"hash"
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/hashing.go#L40-L43 |
30,043 | xyproto/permissions2 | userstate.go | NewUserStateWithPassword | func NewUserStateWithPassword(hostname, password string) *UserState {
// db index 0, initialize random generator after generating the cookie secret, password
var connectTo string
switch {
case (password == "") && (strings.Count(hostname, ":") == 0):
connectTo = hostname + ":6379"
case strings.Count(hostname, ":"... | go | func NewUserStateWithPassword(hostname, password string) *UserState {
// db index 0, initialize random generator after generating the cookie secret, password
var connectTo string
switch {
case (password == "") && (strings.Count(hostname, ":") == 0):
connectTo = hostname + ":6379"
case strings.Count(hostname, ":"... | [
"func",
"NewUserStateWithPassword",
"(",
"hostname",
",",
"password",
"string",
")",
"*",
"UserState",
"{",
"// db index 0, initialize random generator after generating the cookie secret, password",
"var",
"connectTo",
"string",
"\n",
"switch",
"{",
"case",
"(",
"password",
... | // Same as NewUserStateSimple, but takes a hostname and a password.
// Use NewUserState for control over the database index and port number.
// Calls log.Fatal if things go wrong. | [
"Same",
"as",
"NewUserStateSimple",
"but",
"takes",
"a",
"hostname",
"and",
"a",
"password",
".",
"Use",
"NewUserState",
"for",
"control",
"over",
"the",
"database",
"index",
"and",
"port",
"number",
".",
"Calls",
"log",
".",
"Fatal",
"if",
"things",
"go",
... | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L63-L77 |
30,044 | xyproto/permissions2 | userstate.go | NewUserStateWithPassword2 | func NewUserStateWithPassword2(hostname, password string) (*UserState, error) {
// db index 0, initialize random generator after generating the cookie secret, password
var connectTo string
if (password == "") && (strings.Count(hostname, ":") == 0) {
connectTo = hostname + ":6379"
} else if strings.Count(hostname,... | go | func NewUserStateWithPassword2(hostname, password string) (*UserState, error) {
// db index 0, initialize random generator after generating the cookie secret, password
var connectTo string
if (password == "") && (strings.Count(hostname, ":") == 0) {
connectTo = hostname + ":6379"
} else if strings.Count(hostname,... | [
"func",
"NewUserStateWithPassword2",
"(",
"hostname",
",",
"password",
"string",
")",
"(",
"*",
"UserState",
",",
"error",
")",
"{",
"// db index 0, initialize random generator after generating the cookie secret, password",
"var",
"connectTo",
"string",
"\n",
"if",
"(",
"... | // Same as NewUserStateSimple, but takes a hostname and a password.
// Use NewUserState for control over the database index and port number.
// Returns an error if things go wrong. | [
"Same",
"as",
"NewUserStateSimple",
"but",
"takes",
"a",
"hostname",
"and",
"a",
"password",
".",
"Use",
"NewUserState",
"for",
"control",
"over",
"the",
"database",
"index",
"and",
"port",
"number",
".",
"Returns",
"an",
"error",
"if",
"things",
"go",
"wron... | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L82-L95 |
30,045 | xyproto/permissions2 | userstate.go | HasUser | func (state *UserState) HasUser(username string) bool {
val, err := state.usernames.Has(username)
if err != nil {
// This happened at concurrent connections before introducing the connection pool
panic("ERROR: Lost connection to Redis?")
}
return val
} | go | func (state *UserState) HasUser(username string) bool {
val, err := state.usernames.Has(username)
if err != nil {
// This happened at concurrent connections before introducing the connection pool
panic("ERROR: Lost connection to Redis?")
}
return val
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"HasUser",
"(",
"username",
"string",
")",
"bool",
"{",
"val",
",",
"err",
":=",
"state",
".",
"usernames",
".",
"Has",
"(",
"username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// This happened at concurren... | // HasUser checks if the given username exists. | [
"HasUser",
"checks",
"if",
"the",
"given",
"username",
"exists",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L259-L266 |
30,046 | xyproto/permissions2 | userstate.go | HasUser2 | func (state *UserState) HasUser2(username string) (bool, error) {
val, err := state.usernames.Has(username)
if err != nil {
// This happened at concurrent connections before introducing the connection pool
return false, errors.New("Lost connection to Redis?")
}
return val, nil
} | go | func (state *UserState) HasUser2(username string) (bool, error) {
val, err := state.usernames.Has(username)
if err != nil {
// This happened at concurrent connections before introducing the connection pool
return false, errors.New("Lost connection to Redis?")
}
return val, nil
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"HasUser2",
"(",
"username",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"val",
",",
"err",
":=",
"state",
".",
"usernames",
".",
"Has",
"(",
"username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // HasUser2 checks if the given username exists. | [
"HasUser2",
"checks",
"if",
"the",
"given",
"username",
"exists",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L269-L276 |
30,047 | xyproto/permissions2 | userstate.go | BooleanField | func (state *UserState) BooleanField(username, fieldname string) bool {
hasUser := state.HasUser(username)
if !hasUser {
return false
}
value, err := state.users.Get(username, fieldname)
if err != nil {
return false
}
return value == "true"
} | go | func (state *UserState) BooleanField(username, fieldname string) bool {
hasUser := state.HasUser(username)
if !hasUser {
return false
}
value, err := state.users.Get(username, fieldname)
if err != nil {
return false
}
return value == "true"
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"BooleanField",
"(",
"username",
",",
"fieldname",
"string",
")",
"bool",
"{",
"hasUser",
":=",
"state",
".",
"HasUser",
"(",
"username",
")",
"\n",
"if",
"!",
"hasUser",
"{",
"return",
"false",
"\n",
"}",
"... | // BooleanField returns the boolean value for a given username and field name.
// If the user or field is missing, false will be returned.
// Useful for states where it makes sense that the returned value is not true
// unless everything is in order. | [
"BooleanField",
"returns",
"the",
"boolean",
"value",
"for",
"a",
"given",
"username",
"and",
"field",
"name",
".",
"If",
"the",
"user",
"or",
"field",
"is",
"missing",
"false",
"will",
"be",
"returned",
".",
"Useful",
"for",
"states",
"where",
"it",
"make... | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L304-L314 |
30,048 | xyproto/permissions2 | userstate.go | SetBooleanField | func (state *UserState) SetBooleanField(username, fieldname string, val bool) {
strval := "false"
if val {
strval = "true"
}
state.users.Set(username, fieldname, strval)
} | go | func (state *UserState) SetBooleanField(username, fieldname string, val bool) {
strval := "false"
if val {
strval = "true"
}
state.users.Set(username, fieldname, strval)
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"SetBooleanField",
"(",
"username",
",",
"fieldname",
"string",
",",
"val",
"bool",
")",
"{",
"strval",
":=",
"\"",
"\"",
"\n",
"if",
"val",
"{",
"strval",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"state",
".",
... | // Store a boolean value for the given username and custom fieldname. | [
"Store",
"a",
"boolean",
"value",
"for",
"the",
"given",
"username",
"and",
"custom",
"fieldname",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L317-L323 |
30,049 | xyproto/permissions2 | userstate.go | IsLoggedIn | func (state *UserState) IsLoggedIn(username string) bool {
if !state.HasUser(username) {
return false
}
status, err := state.users.Get(username, "loggedin")
if err != nil {
// Returns "no" if the status can not be retrieved
return false
}
return status == "true"
} | go | func (state *UserState) IsLoggedIn(username string) bool {
if !state.HasUser(username) {
return false
}
status, err := state.users.Get(username, "loggedin")
if err != nil {
// Returns "no" if the status can not be retrieved
return false
}
return status == "true"
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"IsLoggedIn",
"(",
"username",
"string",
")",
"bool",
"{",
"if",
"!",
"state",
".",
"HasUser",
"(",
"username",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"status",
",",
"err",
":=",
"state",
".",
"user... | // IsLoggedIn checks if the given username is logged in. | [
"IsLoggedIn",
"checks",
"if",
"the",
"given",
"username",
"is",
"logged",
"in",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L331-L341 |
30,050 | xyproto/permissions2 | userstate.go | AdminRights | func (state *UserState) AdminRights(req *http.Request) bool {
username, err := state.UsernameCookie(req)
if err != nil {
return false
}
return state.IsLoggedIn(username) && state.IsAdmin(username)
} | go | func (state *UserState) AdminRights(req *http.Request) bool {
username, err := state.UsernameCookie(req)
if err != nil {
return false
}
return state.IsLoggedIn(username) && state.IsAdmin(username)
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"AdminRights",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"bool",
"{",
"username",
",",
"err",
":=",
"state",
".",
"UsernameCookie",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fals... | // AdminRights checks if the current user is logged in and has administrator rights. | [
"AdminRights",
"checks",
"if",
"the",
"current",
"user",
"is",
"logged",
"in",
"and",
"has",
"administrator",
"rights",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L344-L350 |
30,051 | xyproto/permissions2 | userstate.go | Email | func (state *UserState) Email(username string) (string, error) {
return state.users.Get(username, "email")
} | go | func (state *UserState) Email(username string) (string, error) {
return state.users.Get(username, "email")
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"Email",
"(",
"username",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"state",
".",
"users",
".",
"Get",
"(",
"username",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // Email returns the email address for the given username. | [
"Email",
"returns",
"the",
"email",
"address",
"for",
"the",
"given",
"username",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L424-L426 |
30,052 | xyproto/permissions2 | userstate.go | PasswordHash | func (state *UserState) PasswordHash(username string) (string, error) {
return state.users.Get(username, "password")
} | go | func (state *UserState) PasswordHash(username string) (string, error) {
return state.users.Get(username, "password")
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"PasswordHash",
"(",
"username",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"state",
".",
"users",
".",
"Get",
"(",
"username",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // PasswordHash returns the password hash for the given username. | [
"PasswordHash",
"returns",
"the",
"password",
"hash",
"for",
"the",
"given",
"username",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L429-L431 |
30,053 | xyproto/permissions2 | userstate.go | ConfirmationCode | func (state *UserState) ConfirmationCode(username string) (string, error) {
return state.users.Get(username, "confirmationCode")
} | go | func (state *UserState) ConfirmationCode(username string) (string, error) {
return state.users.Get(username, "confirmationCode")
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"ConfirmationCode",
"(",
"username",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"state",
".",
"users",
".",
"Get",
"(",
"username",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // ConfirmationCode gets the confirmation code for a specific user. | [
"ConfirmationCode",
"gets",
"the",
"confirmation",
"code",
"for",
"a",
"specific",
"user",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L439-L441 |
30,054 | xyproto/permissions2 | userstate.go | AddUnconfirmed | func (state *UserState) AddUnconfirmed(username, confirmationCode string) {
state.unconfirmed.Add(username)
state.users.Set(username, "confirmationCode", confirmationCode)
} | go | func (state *UserState) AddUnconfirmed(username, confirmationCode string) {
state.unconfirmed.Add(username)
state.users.Set(username, "confirmationCode", confirmationCode)
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"AddUnconfirmed",
"(",
"username",
",",
"confirmationCode",
"string",
")",
"{",
"state",
".",
"unconfirmed",
".",
"Add",
"(",
"username",
")",
"\n",
"state",
".",
"users",
".",
"Set",
"(",
"username",
",",
"\"... | // AddUnconfirmed adds a user that is registered but not confirmed. | [
"AddUnconfirmed",
"adds",
"a",
"user",
"that",
"is",
"registered",
"but",
"not",
"confirmed",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L449-L452 |
30,055 | xyproto/permissions2 | userstate.go | RemoveUnconfirmed | func (state *UserState) RemoveUnconfirmed(username string) {
state.unconfirmed.Del(username)
state.users.DelKey(username, "confirmationCode")
} | go | func (state *UserState) RemoveUnconfirmed(username string) {
state.unconfirmed.Del(username)
state.users.DelKey(username, "confirmationCode")
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"RemoveUnconfirmed",
"(",
"username",
"string",
")",
"{",
"state",
".",
"unconfirmed",
".",
"Del",
"(",
"username",
")",
"\n",
"state",
".",
"users",
".",
"DelKey",
"(",
"username",
",",
"\"",
"\"",
")",
"\n... | // RemoveUnconfirmed removes a user that is registered but not confirmed. | [
"RemoveUnconfirmed",
"removes",
"a",
"user",
"that",
"is",
"registered",
"but",
"not",
"confirmed",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L455-L458 |
30,056 | xyproto/permissions2 | userstate.go | RemoveUser | func (state *UserState) RemoveUser(username string) {
state.usernames.Del(username)
// Remove additional data as well
// TODO: Ideally, remove all keys belonging to the user.
state.users.DelKey(username, "loggedin")
} | go | func (state *UserState) RemoveUser(username string) {
state.usernames.Del(username)
// Remove additional data as well
// TODO: Ideally, remove all keys belonging to the user.
state.users.DelKey(username, "loggedin")
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"RemoveUser",
"(",
"username",
"string",
")",
"{",
"state",
".",
"usernames",
".",
"Del",
"(",
"username",
")",
"\n",
"// Remove additional data as well",
"// TODO: Ideally, remove all keys belonging to the user.",
"state",
... | // RemoveUser removes user and login status. | [
"RemoveUser",
"removes",
"user",
"and",
"login",
"status",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L466-L471 |
30,057 | xyproto/permissions2 | userstate.go | SetToken | func (state *UserState) SetToken(username, token string, expire time.Duration) {
state.users.SetExpire(username, "token", token, expire)
} | go | func (state *UserState) SetToken(username, token string, expire time.Duration) {
state.users.SetExpire(username, "token", token, expire)
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"SetToken",
"(",
"username",
",",
"token",
"string",
",",
"expire",
"time",
".",
"Duration",
")",
"{",
"state",
".",
"users",
".",
"SetExpire",
"(",
"username",
",",
"\"",
"\"",
",",
"token",
",",
"expire",
... | // SetToken sets a token for a user, for a given expiry time | [
"SetToken",
"sets",
"a",
"token",
"for",
"a",
"user",
"for",
"a",
"given",
"expiry",
"time"
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L484-L486 |
30,058 | xyproto/permissions2 | userstate.go | GetToken | func (state *UserState) GetToken(username string) (string, error) {
return state.users.Get(username, "token")
} | go | func (state *UserState) GetToken(username string) (string, error) {
return state.users.Get(username, "token")
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"GetToken",
"(",
"username",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"state",
".",
"users",
".",
"Get",
"(",
"username",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // GetToken retrieves the token for a user | [
"GetToken",
"retrieves",
"the",
"token",
"for",
"a",
"user"
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L489-L491 |
30,059 | xyproto/permissions2 | userstate.go | SetPassword | func (state *UserState) SetPassword(username, password string) {
state.users.Set(username, "password", state.HashPassword(username, password))
} | go | func (state *UserState) SetPassword(username, password string) {
state.users.Set(username, "password", state.HashPassword(username, password))
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"SetPassword",
"(",
"username",
",",
"password",
"string",
")",
"{",
"state",
".",
"users",
".",
"Set",
"(",
"username",
",",
"\"",
"\"",
",",
"state",
".",
"HashPassword",
"(",
"username",
",",
"password",
... | // SetPassword sets the password for a user. The given password string will be hashed.
// No validation or check of the given password is performed. | [
"SetPassword",
"sets",
"the",
"password",
"for",
"a",
"user",
".",
"The",
"given",
"password",
"string",
"will",
"be",
"hashed",
".",
"No",
"validation",
"or",
"check",
"of",
"the",
"given",
"password",
"is",
"performed",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L500-L502 |
30,060 | xyproto/permissions2 | userstate.go | AddUser | func (state *UserState) AddUser(username, password, email string) {
passwordHash := state.HashPassword(username, password)
state.addUserUnchecked(username, passwordHash, email)
} | go | func (state *UserState) AddUser(username, password, email string) {
passwordHash := state.HashPassword(username, password)
state.addUserUnchecked(username, passwordHash, email)
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"AddUser",
"(",
"username",
",",
"password",
",",
"email",
"string",
")",
"{",
"passwordHash",
":=",
"state",
".",
"HashPassword",
"(",
"username",
",",
"password",
")",
"\n",
"state",
".",
"addUserUnchecked",
"... | // Creates a user and hashes the password, does not check for rights.
// The given data must be valid. | [
"Creates",
"a",
"user",
"and",
"hashes",
"the",
"password",
"does",
"not",
"check",
"for",
"rights",
".",
"The",
"given",
"data",
"must",
"be",
"valid",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L522-L525 |
30,061 | xyproto/permissions2 | userstate.go | Login | func (state *UserState) Login(w http.ResponseWriter, username string) error {
state.SetLoggedIn(username)
return state.SetUsernameCookie(w, username)
} | go | func (state *UserState) Login(w http.ResponseWriter, username string) error {
state.SetLoggedIn(username)
return state.SetUsernameCookie(w, username)
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"Login",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"username",
"string",
")",
"error",
"{",
"state",
".",
"SetLoggedIn",
"(",
"username",
")",
"\n",
"return",
"state",
".",
"SetUsernameCookie",
"(",
"w",
"... | // Convenience function for logging a user in and storing the username in a cookie.
// Returns an error if the cookie could not be set. | [
"Convenience",
"function",
"for",
"logging",
"a",
"user",
"in",
"and",
"storing",
"the",
"username",
"in",
"a",
"cookie",
".",
"Returns",
"an",
"error",
"if",
"the",
"cookie",
"could",
"not",
"be",
"set",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L539-L542 |
30,062 | xyproto/permissions2 | userstate.go | CorrectPassword | func (state *UserState) CorrectPassword(username, password string) bool {
if !state.HasUser(username) {
return false
}
// Retrieve the stored password hash
hash := state.storedHash(username)
if len(hash) == 0 {
return false
}
// Check the password with the right password algorithm
switch state.passwordAl... | go | func (state *UserState) CorrectPassword(username, password string) bool {
if !state.HasUser(username) {
return false
}
// Retrieve the stored password hash
hash := state.storedHash(username)
if len(hash) == 0 {
return false
}
// Check the password with the right password algorithm
switch state.passwordAl... | [
"func",
"(",
"state",
"*",
"UserState",
")",
"CorrectPassword",
"(",
"username",
",",
"password",
"string",
")",
"bool",
"{",
"if",
"!",
"state",
".",
"HasUser",
"(",
"username",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// Retrieve the stored passwor... | // CorrectPassword checks if a password is correct. username is needed because it is part of the hash. | [
"CorrectPassword",
"checks",
"if",
"a",
"password",
"is",
"correct",
".",
"username",
"is",
"needed",
"because",
"it",
"is",
"part",
"of",
"the",
"hash",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L629-L654 |
30,063 | xyproto/permissions2 | userstate.go | AlreadyHasConfirmationCode | func (state *UserState) AlreadyHasConfirmationCode(confirmationCode string) bool {
unconfirmedUsernames, err := state.AllUnconfirmedUsernames()
if err != nil {
return false
}
for _, aUsername := range unconfirmedUsernames {
aConfirmationCode, err := state.ConfirmationCode(aUsername)
if err != nil {
// If t... | go | func (state *UserState) AlreadyHasConfirmationCode(confirmationCode string) bool {
unconfirmedUsernames, err := state.AllUnconfirmedUsernames()
if err != nil {
return false
}
for _, aUsername := range unconfirmedUsernames {
aConfirmationCode, err := state.ConfirmationCode(aUsername)
if err != nil {
// If t... | [
"func",
"(",
"state",
"*",
"UserState",
")",
"AlreadyHasConfirmationCode",
"(",
"confirmationCode",
"string",
")",
"bool",
"{",
"unconfirmedUsernames",
",",
"err",
":=",
"state",
".",
"AllUnconfirmedUsernames",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r... | // AlreadyHasConfirmationCode runs through all confirmation codes of all unconfirmed
// users and checks if this confirmationCode is already in use. | [
"AlreadyHasConfirmationCode",
"runs",
"through",
"all",
"confirmation",
"codes",
"of",
"all",
"unconfirmed",
"users",
"and",
"checks",
"if",
"this",
"confirmationCode",
"is",
"already",
"in",
"use",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L658-L675 |
30,064 | xyproto/permissions2 | userstate.go | Confirm | func (state *UserState) Confirm(username string) {
// Remove from the list of unconfirmed usernames
state.RemoveUnconfirmed(username)
// Mark user as confirmed
state.MarkConfirmed(username)
} | go | func (state *UserState) Confirm(username string) {
// Remove from the list of unconfirmed usernames
state.RemoveUnconfirmed(username)
// Mark user as confirmed
state.MarkConfirmed(username)
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"Confirm",
"(",
"username",
"string",
")",
"{",
"// Remove from the list of unconfirmed usernames",
"state",
".",
"RemoveUnconfirmed",
"(",
"username",
")",
"\n\n",
"// Mark user as confirmed",
"state",
".",
"MarkConfirmed",
... | // Confirm removes the username from the list of unconfirmed users and mark the user as confirmed. | [
"Confirm",
"removes",
"the",
"username",
"from",
"the",
"list",
"of",
"unconfirmed",
"users",
"and",
"mark",
"the",
"user",
"as",
"confirmed",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L712-L718 |
30,065 | xyproto/permissions2 | userstate.go | Creator | func (state *UserState) Creator() pinterface.ICreator {
return simpleredis.NewCreator(state.pool, state.dbindex)
} | go | func (state *UserState) Creator() pinterface.ICreator {
return simpleredis.NewCreator(state.pool, state.dbindex)
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"Creator",
"(",
")",
"pinterface",
".",
"ICreator",
"{",
"return",
"simpleredis",
".",
"NewCreator",
"(",
"state",
".",
"pool",
",",
"state",
".",
"dbindex",
")",
"\n",
"}"
] | // Creator returns a struct for creating data structures with | [
"Creator",
"returns",
"a",
"struct",
"for",
"creating",
"data",
"structures",
"with"
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L773-L775 |
30,066 | xyproto/permissions2 | userstate.go | Properties | func (state *UserState) Properties(username string) []string {
props, err := state.users.Keys(username)
if err != nil {
return []string{}
}
return props
} | go | func (state *UserState) Properties(username string) []string {
props, err := state.users.Keys(username)
if err != nil {
return []string{}
}
return props
} | [
"func",
"(",
"state",
"*",
"UserState",
")",
"Properties",
"(",
"username",
"string",
")",
"[",
"]",
"string",
"{",
"props",
",",
"err",
":=",
"state",
".",
"users",
".",
"Keys",
"(",
"username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // Properties returns a list of user properties.
// Returns an empty list if the user has no properties, or if there are errors. | [
"Properties",
"returns",
"a",
"list",
"of",
"user",
"properties",
".",
"Returns",
"an",
"empty",
"list",
"if",
"the",
"user",
"has",
"no",
"properties",
"or",
"if",
"there",
"are",
"errors",
"."
] | f47b0751729e767ee4c9dcc64a00e4720b95c8e0 | https://github.com/xyproto/permissions2/blob/f47b0751729e767ee4c9dcc64a00e4720b95c8e0/userstate.go#L779-L785 |
30,067 | denverdino/aliyungo | cms/client.go | NewCMSClient | func NewCMSClient(accessKeyId, accessKeySecret string) *CMSClient {
endpoint := os.Getenv("CMS_ENDPOINT")
if endpoint == "" {
endpoint = CMSDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
} | go | func NewCMSClient(accessKeyId, accessKeySecret string) *CMSClient {
endpoint := os.Getenv("CMS_ENDPOINT")
if endpoint == "" {
endpoint = CMSDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
} | [
"func",
"NewCMSClient",
"(",
"accessKeyId",
",",
"accessKeySecret",
"string",
")",
"*",
"CMSClient",
"{",
"endpoint",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"endpoint",
"==",
"\"",
"\"",
"{",
"endpoint",
"=",
"CMSDefaultEndpoint",
"\n... | // NewClient creates a new instance of CMS client | [
"NewClient",
"creates",
"a",
"new",
"instance",
"of",
"CMS",
"client"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/cms/client.go#L77-L83 |
30,068 | denverdino/aliyungo | kms/client.go | NewClient | func NewClient(accessKeyId, accessKeySecret string) *Client {
endpoint := os.Getenv("KMS_ENDPOINT")
if endpoint == "" {
endpoint = KMSDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
} | go | func NewClient(accessKeyId, accessKeySecret string) *Client {
endpoint := os.Getenv("KMS_ENDPOINT")
if endpoint == "" {
endpoint = KMSDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
} | [
"func",
"NewClient",
"(",
"accessKeyId",
",",
"accessKeySecret",
"string",
")",
"*",
"Client",
"{",
"endpoint",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"endpoint",
"==",
"\"",
"\"",
"{",
"endpoint",
"=",
"KMSDefaultEndpoint",
"\n",
"... | // NewClient creates a new instance of KMS client | [
"NewClient",
"creates",
"a",
"new",
"instance",
"of",
"KMS",
"client"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/kms/client.go#L21-L27 |
30,069 | denverdino/aliyungo | ess/configuration.go | DeactivateScalingConfiguration | func (client *Client) DeactivateScalingConfiguration(args *DeactivateScalingConfigurationArgs) (resp *DeactivateScalingConfigurationResponse, err error) {
response := DeactivateScalingConfigurationResponse{}
err = client.InvokeByFlattenMethod("DeactivateScalingConfiguration", args, &response)
if err != nil {
retu... | go | func (client *Client) DeactivateScalingConfiguration(args *DeactivateScalingConfigurationArgs) (resp *DeactivateScalingConfigurationResponse, err error) {
response := DeactivateScalingConfigurationResponse{}
err = client.InvokeByFlattenMethod("DeactivateScalingConfiguration", args, &response)
if err != nil {
retu... | [
"func",
"(",
"client",
"*",
"Client",
")",
"DeactivateScalingConfiguration",
"(",
"args",
"*",
"DeactivateScalingConfigurationArgs",
")",
"(",
"resp",
"*",
"DeactivateScalingConfigurationResponse",
",",
"err",
"error",
")",
"{",
"response",
":=",
"DeactivateScalingConfi... | // DeactivateScalingConfiguration deactivate scaling configuration
// | [
"DeactivateScalingConfiguration",
"deactivate",
"scaling",
"configuration"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/ess/configuration.go#L161-L169 |
30,070 | denverdino/aliyungo | slb/servers.go | SetBackendServers | func (client *Client) SetBackendServers(loadBalancerId string, backendServers []BackendServerType) (result []BackendServerType, err error) {
bytes, _ := json.Marshal(backendServers)
args := &SetBackendServersArgs{
LoadBalancerId: loadBalancerId,
BackendServers: string(bytes),
}
response := &SetBackendServersRe... | go | func (client *Client) SetBackendServers(loadBalancerId string, backendServers []BackendServerType) (result []BackendServerType, err error) {
bytes, _ := json.Marshal(backendServers)
args := &SetBackendServersArgs{
LoadBalancerId: loadBalancerId,
BackendServers: string(bytes),
}
response := &SetBackendServersRe... | [
"func",
"(",
"client",
"*",
"Client",
")",
"SetBackendServers",
"(",
"loadBalancerId",
"string",
",",
"backendServers",
"[",
"]",
"BackendServerType",
")",
"(",
"result",
"[",
"]",
"BackendServerType",
",",
"err",
"error",
")",
"{",
"bytes",
",",
"_",
":=",
... | // SetBackendServers set weight of backend servers | [
"SetBackendServers",
"set",
"weight",
"of",
"backend",
"servers"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/slb/servers.go#L27-L41 |
30,071 | denverdino/aliyungo | util/encoding.go | ConvertToQueryValues | func ConvertToQueryValues(ifc interface{}) url.Values {
values := url.Values{}
SetQueryValues(ifc, &values)
return values
} | go | func ConvertToQueryValues(ifc interface{}) url.Values {
values := url.Values{}
SetQueryValues(ifc, &values)
return values
} | [
"func",
"ConvertToQueryValues",
"(",
"ifc",
"interface",
"{",
"}",
")",
"url",
".",
"Values",
"{",
"values",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"SetQueryValues",
"(",
"ifc",
",",
"&",
"values",
")",
"\n",
"return",
"values",
"\n",
"}"
] | //ConvertToQueryValues converts the struct to url.Values | [
"ConvertToQueryValues",
"converts",
"the",
"struct",
"to",
"url",
".",
"Values"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/util/encoding.go#L31-L35 |
30,072 | denverdino/aliyungo | ecs/router_interface.go | WaitForRouterInterfaceAsyn | func (client *Client) WaitForRouterInterfaceAsyn(regionId common.Region, interfaceId string, status InterfaceStatus, timeout int) error {
if timeout <= 0 {
timeout = InstanceDefaultTimeout
}
for {
interfaces, err := client.DescribeRouterInterfaces(&DescribeRouterInterfacesArgs{
RegionId: regionId,
Filter: ... | go | func (client *Client) WaitForRouterInterfaceAsyn(regionId common.Region, interfaceId string, status InterfaceStatus, timeout int) error {
if timeout <= 0 {
timeout = InstanceDefaultTimeout
}
for {
interfaces, err := client.DescribeRouterInterfaces(&DescribeRouterInterfacesArgs{
RegionId: regionId,
Filter: ... | [
"func",
"(",
"client",
"*",
"Client",
")",
"WaitForRouterInterfaceAsyn",
"(",
"regionId",
"common",
".",
"Region",
",",
"interfaceId",
"string",
",",
"status",
"InterfaceStatus",
",",
"timeout",
"int",
")",
"error",
"{",
"if",
"timeout",
"<=",
"0",
"{",
"tim... | // WaitForRouterInterface waits for router interface to given status | [
"WaitForRouterInterface",
"waits",
"for",
"router",
"interface",
"to",
"given",
"status"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/ecs/router_interface.go#L234-L257 |
30,073 | denverdino/aliyungo | slb/zones.go | DescribeZones | func (client *Client) DescribeZones(regionId common.Region) (zones []ZoneType, err error) {
response, err := client.DescribeZonesWithRaw(regionId)
if err == nil {
return response.Zones.Zone, nil
}
return []ZoneType{}, err
} | go | func (client *Client) DescribeZones(regionId common.Region) (zones []ZoneType, err error) {
response, err := client.DescribeZonesWithRaw(regionId)
if err == nil {
return response.Zones.Zone, nil
}
return []ZoneType{}, err
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"DescribeZones",
"(",
"regionId",
"common",
".",
"Region",
")",
"(",
"zones",
"[",
"]",
"ZoneType",
",",
"err",
"error",
")",
"{",
"response",
",",
"err",
":=",
"client",
".",
"DescribeZonesWithRaw",
"(",
"regio... | // DescribeZones describes zones | [
"DescribeZones",
"describes",
"zones"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/slb/zones.go#L29-L36 |
30,074 | denverdino/aliyungo | rds/instances.go | CreateOrder | func (client *Client) CreateOrder(args *CreateOrderArgs) (resp CreateOrderResponse, err error) {
response := CreateOrderResponse{}
err = client.Invoke("CreateOrder", args, &response)
return response, err
} | go | func (client *Client) CreateOrder(args *CreateOrderArgs) (resp CreateOrderResponse, err error) {
response := CreateOrderResponse{}
err = client.Invoke("CreateOrder", args, &response)
return response, err
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateOrder",
"(",
"args",
"*",
"CreateOrderArgs",
")",
"(",
"resp",
"CreateOrderResponse",
",",
"err",
"error",
")",
"{",
"response",
":=",
"CreateOrderResponse",
"{",
"}",
"\n",
"err",
"=",
"client",
".",
"Invo... | // CreateOrder create db instance order | [
"CreateOrder",
"create",
"db",
"instance",
"order"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/rds/instances.go#L208-L212 |
30,075 | denverdino/aliyungo | cs/clusters.go | ResizeKubernetes | func (client *Client) ResizeKubernetes(clusterID string, args *KubernetesCreationArgs) error {
return client.Invoke("", http.MethodPut, "/clusters/"+clusterID, nil, args, nil)
} | go | func (client *Client) ResizeKubernetes(clusterID string, args *KubernetesCreationArgs) error {
return client.Invoke("", http.MethodPut, "/clusters/"+clusterID, nil, args, nil)
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"ResizeKubernetes",
"(",
"clusterID",
"string",
",",
"args",
"*",
"KubernetesCreationArgs",
")",
"error",
"{",
"return",
"client",
".",
"Invoke",
"(",
"\"",
"\"",
",",
"http",
".",
"MethodPut",
",",
"\"",
"\"",
... | // deprecated
// use ResizeKubernetesCluster instead | [
"deprecated",
"use",
"ResizeKubernetesCluster",
"instead"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/cs/clusters.go#L410-L412 |
30,076 | denverdino/aliyungo | cs/clusters.go | WaitForClusterAsyn | func (client *Client) WaitForClusterAsyn(clusterId string, status ClusterState, timeout int) error {
if timeout <= 0 {
timeout = ClusterDefaultTimeout
}
// Sleep 20 second to check cluster creating or failed
sleep := math.Min(float64(timeout), float64(DefaultPreCheckSleepTime))
time.Sleep(time.Duration(sleep) *... | go | func (client *Client) WaitForClusterAsyn(clusterId string, status ClusterState, timeout int) error {
if timeout <= 0 {
timeout = ClusterDefaultTimeout
}
// Sleep 20 second to check cluster creating or failed
sleep := math.Min(float64(timeout), float64(DefaultPreCheckSleepTime))
time.Sleep(time.Duration(sleep) *... | [
"func",
"(",
"client",
"*",
"Client",
")",
"WaitForClusterAsyn",
"(",
"clusterId",
"string",
",",
"status",
"ClusterState",
",",
"timeout",
"int",
")",
"error",
"{",
"if",
"timeout",
"<=",
"0",
"{",
"timeout",
"=",
"ClusterDefaultTimeout",
"\n",
"}",
"\n\n",... | // WaitForCluster waits for instance to given status
// when instance.NotFound wait until timeout | [
"WaitForCluster",
"waits",
"for",
"instance",
"to",
"given",
"status",
"when",
"instance",
".",
"NotFound",
"wait",
"until",
"timeout"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/cs/clusters.go#L513-L553 |
30,077 | denverdino/aliyungo | ess/group.go | WaitForScalingGroup | func (client *Client) WaitForScalingGroup(regionId common.Region, groupId string, status LifecycleState, timeout int) error {
if timeout <= 0 {
timeout = DefaultWaitTimeout
}
for {
sgs, _, err := client.DescribeScalingGroups(&DescribeScalingGroupsArgs{
RegionId: regionId,
ScalingGroupId: []string{gro... | go | func (client *Client) WaitForScalingGroup(regionId common.Region, groupId string, status LifecycleState, timeout int) error {
if timeout <= 0 {
timeout = DefaultWaitTimeout
}
for {
sgs, _, err := client.DescribeScalingGroups(&DescribeScalingGroupsArgs{
RegionId: regionId,
ScalingGroupId: []string{gro... | [
"func",
"(",
"client",
"*",
"Client",
")",
"WaitForScalingGroup",
"(",
"regionId",
"common",
".",
"Region",
",",
"groupId",
"string",
",",
"status",
"LifecycleState",
",",
"timeout",
"int",
")",
"error",
"{",
"if",
"timeout",
"<=",
"0",
"{",
"timeout",
"="... | // WaitForScalingGroup waits for group to given status | [
"WaitForScalingGroup",
"waits",
"for",
"group",
"to",
"given",
"status"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/ess/group.go#L311-L340 |
30,078 | denverdino/aliyungo | ecs/images.go | WaitForImageReady | func (client *Client) WaitForImageReady(regionId common.Region, imageId string, timeout int) error {
if timeout <= 0 {
timeout = ImageDefaultTimeout
}
for {
args := DescribeImagesArgs{
RegionId: regionId,
ImageId: imageId,
Status: ImageStatusCreating,
}
images, _, err := client.DescribeImages(&a... | go | func (client *Client) WaitForImageReady(regionId common.Region, imageId string, timeout int) error {
if timeout <= 0 {
timeout = ImageDefaultTimeout
}
for {
args := DescribeImagesArgs{
RegionId: regionId,
ImageId: imageId,
Status: ImageStatusCreating,
}
images, _, err := client.DescribeImages(&a... | [
"func",
"(",
"client",
"*",
"Client",
")",
"WaitForImageReady",
"(",
"regionId",
"common",
".",
"Region",
",",
"imageId",
"string",
",",
"timeout",
"int",
")",
"error",
"{",
"if",
"timeout",
"<=",
"0",
"{",
"timeout",
"=",
"ImageDefaultTimeout",
"\n",
"}",... | //Wait Image ready | [
"Wait",
"Image",
"ready"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/ecs/images.go#L301-L335 |
30,079 | denverdino/aliyungo | oss/regions.go | GetInternetEndpoint | func (r Region) GetInternetEndpoint(bucket string, secure bool) string {
protocol := getProtocol(secure)
if bucket == "" {
return fmt.Sprintf("%s://oss.aliyuncs.com", protocol)
}
return fmt.Sprintf("%s://%s.%s.aliyuncs.com", protocol, bucket, string(r))
} | go | func (r Region) GetInternetEndpoint(bucket string, secure bool) string {
protocol := getProtocol(secure)
if bucket == "" {
return fmt.Sprintf("%s://oss.aliyuncs.com", protocol)
}
return fmt.Sprintf("%s://%s.%s.aliyuncs.com", protocol, bucket, string(r))
} | [
"func",
"(",
"r",
"Region",
")",
"GetInternetEndpoint",
"(",
"bucket",
"string",
",",
"secure",
"bool",
")",
"string",
"{",
"protocol",
":=",
"getProtocol",
"(",
"secure",
")",
"\n",
"if",
"bucket",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Sprintf",... | // GetInternetEndpoint returns internet endpoint of region | [
"GetInternetEndpoint",
"returns",
"internet",
"endpoint",
"of",
"region"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/oss/regions.go#L52-L58 |
30,080 | denverdino/aliyungo | ecs/snapshots.go | WaitForSnapShotReady | func (client *Client) WaitForSnapShotReady(regionId common.Region, snapshotId string, timeout int) error {
if timeout <= 0 {
timeout = SnapshotDefaultTimeout
}
for {
args := DescribeSnapshotsArgs{
RegionId: regionId,
SnapshotIds: []string{snapshotId},
}
snapshots, _, err := client.DescribeSnapshots... | go | func (client *Client) WaitForSnapShotReady(regionId common.Region, snapshotId string, timeout int) error {
if timeout <= 0 {
timeout = SnapshotDefaultTimeout
}
for {
args := DescribeSnapshotsArgs{
RegionId: regionId,
SnapshotIds: []string{snapshotId},
}
snapshots, _, err := client.DescribeSnapshots... | [
"func",
"(",
"client",
"*",
"Client",
")",
"WaitForSnapShotReady",
"(",
"regionId",
"common",
".",
"Region",
",",
"snapshotId",
"string",
",",
"timeout",
"int",
")",
"error",
"{",
"if",
"timeout",
"<=",
"0",
"{",
"timeout",
"=",
"SnapshotDefaultTimeout",
"\n... | // WaitForSnapShotReady waits for snapshot ready | [
"WaitForSnapShotReady",
"waits",
"for",
"snapshot",
"ready"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/ecs/snapshots.go#L115-L142 |
30,081 | denverdino/aliyungo | sls/client.go | NewClient | func NewClient(region common.Region, internal bool, accessKeyId, accessKeySecret string) *Client {
endpoint := os.Getenv("SLS_ENDPOINT")
if endpoint == "" {
endpoint = SLSDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, region, internal, accessKeyId, accessKeySecret)
} | go | func NewClient(region common.Region, internal bool, accessKeyId, accessKeySecret string) *Client {
endpoint := os.Getenv("SLS_ENDPOINT")
if endpoint == "" {
endpoint = SLSDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, region, internal, accessKeyId, accessKeySecret)
} | [
"func",
"NewClient",
"(",
"region",
"common",
".",
"Region",
",",
"internal",
"bool",
",",
"accessKeyId",
",",
"accessKeySecret",
"string",
")",
"*",
"Client",
"{",
"endpoint",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"endpoint",
"=="... | // NewClient creates a new instance of ECS client | [
"NewClient",
"creates",
"a",
"new",
"instance",
"of",
"ECS",
"client"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/sls/client.go#L70-L76 |
30,082 | denverdino/aliyungo | ros/client.go | NewClient | func NewClient(accessKeyId, accessKeySecret string) *Client {
return &Client{
AccessKeyId: accessKeyId,
AccessKeySecret: accessKeySecret,
endpoint: ROSDefaultEndpoint,
Version: ROSAPIVersion,
httpClient: &http.Client{},
}
} | go | func NewClient(accessKeyId, accessKeySecret string) *Client {
return &Client{
AccessKeyId: accessKeyId,
AccessKeySecret: accessKeySecret,
endpoint: ROSDefaultEndpoint,
Version: ROSAPIVersion,
httpClient: &http.Client{},
}
} | [
"func",
"NewClient",
"(",
"accessKeyId",
",",
"accessKeySecret",
"string",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"AccessKeyId",
":",
"accessKeyId",
",",
"AccessKeySecret",
":",
"accessKeySecret",
",",
"endpoint",
":",
"ROSDefaultEndpoint",
",",
... | // NewClient creates a new instance of ROS client | [
"NewClient",
"creates",
"a",
"new",
"instance",
"of",
"ROS",
"client"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/ros/client.go#L43-L51 |
30,083 | denverdino/aliyungo | cdn/auth/sign_url.go | NewURLSigner | func NewURLSigner(authType string, privKey string) *URLSigner {
return &URLSigner{
authType: authType,
privKey: privKey,
}
} | go | func NewURLSigner(authType string, privKey string) *URLSigner {
return &URLSigner{
authType: authType,
privKey: privKey,
}
} | [
"func",
"NewURLSigner",
"(",
"authType",
"string",
",",
"privKey",
"string",
")",
"*",
"URLSigner",
"{",
"return",
"&",
"URLSigner",
"{",
"authType",
":",
"authType",
",",
"privKey",
":",
"privKey",
",",
"}",
"\n",
"}"
] | // NewURLSigner returns a new signer object. | [
"NewURLSigner",
"returns",
"a",
"new",
"signer",
"object",
"."
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/cdn/auth/sign_url.go#L19-L24 |
30,084 | denverdino/aliyungo | cdn/auth/sign_url.go | Sign | func (s URLSigner) Sign(uri string, expires time.Time) (string, error) {
r, err := url.Parse(uri)
if err != nil {
return "", fmt.Errorf("unable to parse url: %s", uri)
}
switch s.authType {
case "a":
return aTypeSign(r, s.privKey, expires), nil
case "b":
return bTypeSign(r, s.privKey, expires), nil
case "... | go | func (s URLSigner) Sign(uri string, expires time.Time) (string, error) {
r, err := url.Parse(uri)
if err != nil {
return "", fmt.Errorf("unable to parse url: %s", uri)
}
switch s.authType {
case "a":
return aTypeSign(r, s.privKey, expires), nil
case "b":
return bTypeSign(r, s.privKey, expires), nil
case "... | [
"func",
"(",
"s",
"URLSigner",
")",
"Sign",
"(",
"uri",
"string",
",",
"expires",
"time",
".",
"Time",
")",
"(",
"string",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"uri",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // Sign returns a signed aliyuncdn url based on authentication type | [
"Sign",
"returns",
"a",
"signed",
"aliyuncdn",
"url",
"based",
"on",
"authentication",
"type"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/cdn/auth/sign_url.go#L27-L43 |
30,085 | denverdino/aliyungo | oss/multi.go | Complete | func (m *Multi) Complete(parts []Part) error {
params := make(url.Values)
params.Set("uploadId", m.UploadId)
c := completeUpload{}
for _, p := range parts {
c.Parts = append(c.Parts, completePart{p.N, p.ETag})
}
sort.Sort(c.Parts)
data, err := xml.Marshal(&c)
if err != nil {
return err
}
for attempt := a... | go | func (m *Multi) Complete(parts []Part) error {
params := make(url.Values)
params.Set("uploadId", m.UploadId)
c := completeUpload{}
for _, p := range parts {
c.Parts = append(c.Parts, completePart{p.N, p.ETag})
}
sort.Sort(c.Parts)
data, err := xml.Marshal(&c)
if err != nil {
return err
}
for attempt := a... | [
"func",
"(",
"m",
"*",
"Multi",
")",
"Complete",
"(",
"parts",
"[",
"]",
"Part",
")",
"error",
"{",
"params",
":=",
"make",
"(",
"url",
".",
"Values",
")",
"\n",
"params",
".",
"Set",
"(",
"\"",
"\"",
",",
"m",
".",
"UploadId",
")",
"\n\n",
"c"... | // Complete assembles the given previously uploaded parts into the
// final object. This operation may take several minutes.
// | [
"Complete",
"assembles",
"the",
"given",
"previously",
"uploaded",
"parts",
"into",
"the",
"final",
"object",
".",
"This",
"operation",
"may",
"take",
"several",
"minutes",
"."
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/oss/multi.go#L425-L453 |
30,086 | denverdino/aliyungo | common/client.go | Init | func (client *Client) Init(endpoint, version, accessKeyId, accessKeySecret string) {
client.AccessKeyId = accessKeyId
ak := accessKeySecret
if !strings.HasSuffix(ak, "&") {
ak += "&"
}
client.AccessKeySecret = ak
client.debug = false
handshakeTimeout, err := strconv.Atoi(os.Getenv("TLSHandshakeTimeout"))
if e... | go | func (client *Client) Init(endpoint, version, accessKeyId, accessKeySecret string) {
client.AccessKeyId = accessKeyId
ak := accessKeySecret
if !strings.HasSuffix(ak, "&") {
ak += "&"
}
client.AccessKeySecret = ak
client.debug = false
handshakeTimeout, err := strconv.Atoi(os.Getenv("TLSHandshakeTimeout"))
if e... | [
"func",
"(",
"client",
"*",
"Client",
")",
"Init",
"(",
"endpoint",
",",
"version",
",",
"accessKeyId",
",",
"accessKeySecret",
"string",
")",
"{",
"client",
".",
"AccessKeyId",
"=",
"accessKeyId",
"\n",
"ak",
":=",
"accessKeySecret",
"\n",
"if",
"!",
"str... | // Initialize properties of a client instance | [
"Initialize",
"properties",
"of",
"a",
"client",
"instance"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L44-L65 |
30,087 | denverdino/aliyungo | common/client.go | NewInit | func (client *Client) NewInit(endpoint, version, accessKeyId, accessKeySecret, serviceCode string, regionID Region) {
client.Init(endpoint, version, accessKeyId, accessKeySecret)
client.serviceCode = serviceCode
client.regionID = regionID
} | go | func (client *Client) NewInit(endpoint, version, accessKeyId, accessKeySecret, serviceCode string, regionID Region) {
client.Init(endpoint, version, accessKeyId, accessKeySecret)
client.serviceCode = serviceCode
client.regionID = regionID
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"NewInit",
"(",
"endpoint",
",",
"version",
",",
"accessKeyId",
",",
"accessKeySecret",
",",
"serviceCode",
"string",
",",
"regionID",
"Region",
")",
"{",
"client",
".",
"Init",
"(",
"endpoint",
",",
"version",
",... | // Initialize properties of a client instance including regionID | [
"Initialize",
"properties",
"of",
"a",
"client",
"instance",
"including",
"regionID"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L68-L72 |
30,088 | denverdino/aliyungo | common/client.go | InitClient | func (client *Client) InitClient() *Client {
client.debug = false
handshakeTimeout, err := strconv.Atoi(os.Getenv("TLSHandshakeTimeout"))
if err != nil {
handshakeTimeout = 0
}
if handshakeTimeout == 0 {
client.httpClient = &http.Client{}
} else {
t := &http.Transport{
TLSHandshakeTimeout: time.Duration(... | go | func (client *Client) InitClient() *Client {
client.debug = false
handshakeTimeout, err := strconv.Atoi(os.Getenv("TLSHandshakeTimeout"))
if err != nil {
handshakeTimeout = 0
}
if handshakeTimeout == 0 {
client.httpClient = &http.Client{}
} else {
t := &http.Transport{
TLSHandshakeTimeout: time.Duration(... | [
"func",
"(",
"client",
"*",
"Client",
")",
"InitClient",
"(",
")",
"*",
"Client",
"{",
"client",
".",
"debug",
"=",
"false",
"\n",
"handshakeTimeout",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
")",
"\... | // Intialize client object when all properties are ready | [
"Intialize",
"client",
"object",
"when",
"all",
"properties",
"are",
"ready"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L75-L89 |
30,089 | denverdino/aliyungo | common/client.go | setEndpointByLocation | func (client *Client) setEndpointByLocation(region Region, serviceCode, accessKeyId, accessKeySecret, securityToken string) {
locationClient := NewLocationClient(accessKeyId, accessKeySecret, securityToken)
locationClient.SetDebug(true)
ep := locationClient.DescribeOpenAPIEndpoint(region, serviceCode)
if ep == "" {... | go | func (client *Client) setEndpointByLocation(region Region, serviceCode, accessKeyId, accessKeySecret, securityToken string) {
locationClient := NewLocationClient(accessKeyId, accessKeySecret, securityToken)
locationClient.SetDebug(true)
ep := locationClient.DescribeOpenAPIEndpoint(region, serviceCode)
if ep == "" {... | [
"func",
"(",
"client",
"*",
"Client",
")",
"setEndpointByLocation",
"(",
"region",
"Region",
",",
"serviceCode",
",",
"accessKeyId",
",",
"accessKeySecret",
",",
"securityToken",
"string",
")",
"{",
"locationClient",
":=",
"NewLocationClient",
"(",
"accessKeyId",
... | //NewClient using location service | [
"NewClient",
"using",
"location",
"service"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L104-L115 |
30,090 | denverdino/aliyungo | common/client.go | ensureProperties | func (client *Client) ensureProperties() error {
var msg string
if client.endpoint == "" {
msg = fmt.Sprintf("endpoint cannot be empty!")
} else if client.version == "" {
msg = fmt.Sprintf("version cannot be empty!")
} else if client.AccessKeyId == "" {
msg = fmt.Sprintf("AccessKeyId cannot be empty!")
} el... | go | func (client *Client) ensureProperties() error {
var msg string
if client.endpoint == "" {
msg = fmt.Sprintf("endpoint cannot be empty!")
} else if client.version == "" {
msg = fmt.Sprintf("version cannot be empty!")
} else if client.AccessKeyId == "" {
msg = fmt.Sprintf("AccessKeyId cannot be empty!")
} el... | [
"func",
"(",
"client",
"*",
"Client",
")",
"ensureProperties",
"(",
")",
"error",
"{",
"var",
"msg",
"string",
"\n\n",
"if",
"client",
".",
"endpoint",
"==",
"\"",
"\"",
"{",
"msg",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else... | // Ensure all necessary properties are valid | [
"Ensure",
"all",
"necessary",
"properties",
"are",
"valid"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L118-L136 |
30,091 | denverdino/aliyungo | common/client.go | WithVersion | func (client *Client) WithVersion(version string) *Client {
client.SetVersion(version)
return client
} | go | func (client *Client) WithVersion(version string) *Client {
client.SetVersion(version)
return client
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"WithVersion",
"(",
"version",
"string",
")",
"*",
"Client",
"{",
"client",
".",
"SetVersion",
"(",
"version",
")",
"\n",
"return",
"client",
"\n",
"}"
] | // WithVersion sets custom version | [
"WithVersion",
"sets",
"custom",
"version"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L149-L152 |
30,092 | denverdino/aliyungo | common/client.go | WithRegionID | func (client *Client) WithRegionID(regionID Region) *Client {
client.SetRegionID(regionID)
return client
} | go | func (client *Client) WithRegionID(regionID Region) *Client {
client.SetRegionID(regionID)
return client
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"WithRegionID",
"(",
"regionID",
"Region",
")",
"*",
"Client",
"{",
"client",
".",
"SetRegionID",
"(",
"regionID",
")",
"\n",
"return",
"client",
"\n",
"}"
] | // WithRegionID sets Region ID | [
"WithRegionID",
"sets",
"Region",
"ID"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L155-L158 |
30,093 | denverdino/aliyungo | common/client.go | WithServiceCode | func (client *Client) WithServiceCode(serviceCode string) *Client {
client.SetServiceCode(serviceCode)
return client
} | go | func (client *Client) WithServiceCode(serviceCode string) *Client {
client.SetServiceCode(serviceCode)
return client
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"WithServiceCode",
"(",
"serviceCode",
"string",
")",
"*",
"Client",
"{",
"client",
".",
"SetServiceCode",
"(",
"serviceCode",
")",
"\n",
"return",
"client",
"\n",
"}"
] | //WithServiceCode sets serviceCode | [
"WithServiceCode",
"sets",
"serviceCode"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L161-L164 |
30,094 | denverdino/aliyungo | common/client.go | WithAccessKeyId | func (client *Client) WithAccessKeyId(id string) *Client {
client.SetAccessKeyId(id)
return client
} | go | func (client *Client) WithAccessKeyId(id string) *Client {
client.SetAccessKeyId(id)
return client
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"WithAccessKeyId",
"(",
"id",
"string",
")",
"*",
"Client",
"{",
"client",
".",
"SetAccessKeyId",
"(",
"id",
")",
"\n",
"return",
"client",
"\n",
"}"
] | // WithAccessKeyId sets new AccessKeyId | [
"WithAccessKeyId",
"sets",
"new",
"AccessKeyId"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L167-L170 |
30,095 | denverdino/aliyungo | common/client.go | WithAccessKeySecret | func (client *Client) WithAccessKeySecret(secret string) *Client {
client.SetAccessKeySecret(secret)
return client
} | go | func (client *Client) WithAccessKeySecret(secret string) *Client {
client.SetAccessKeySecret(secret)
return client
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"WithAccessKeySecret",
"(",
"secret",
"string",
")",
"*",
"Client",
"{",
"client",
".",
"SetAccessKeySecret",
"(",
"secret",
")",
"\n",
"return",
"client",
"\n",
"}"
] | // WithAccessKeySecret sets new AccessKeySecret | [
"WithAccessKeySecret",
"sets",
"new",
"AccessKeySecret"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L173-L176 |
30,096 | denverdino/aliyungo | common/client.go | WithSecurityToken | func (client *Client) WithSecurityToken(securityToken string) *Client {
client.SetSecurityToken(securityToken)
return client
} | go | func (client *Client) WithSecurityToken(securityToken string) *Client {
client.SetSecurityToken(securityToken)
return client
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"WithSecurityToken",
"(",
"securityToken",
"string",
")",
"*",
"Client",
"{",
"client",
".",
"SetSecurityToken",
"(",
"securityToken",
")",
"\n",
"return",
"client",
"\n",
"}"
] | // WithSecurityToken sets securityToken | [
"WithSecurityToken",
"sets",
"securityToken"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L179-L182 |
30,097 | denverdino/aliyungo | common/client.go | Invoke | func (client *Client) Invoke(action string, args interface{}, response interface{}) error {
if err := client.ensureProperties(); err != nil {
return err
}
//init endpoint
if err := client.initEndpoint(); err != nil {
return err
}
request := Request{}
request.init(client.version, action, client.AccessKeyId,... | go | func (client *Client) Invoke(action string, args interface{}, response interface{}) error {
if err := client.ensureProperties(); err != nil {
return err
}
//init endpoint
if err := client.initEndpoint(); err != nil {
return err
}
request := Request{}
request.init(client.version, action, client.AccessKeyId,... | [
"func",
"(",
"client",
"*",
"Client",
")",
"Invoke",
"(",
"action",
"string",
",",
"args",
"interface",
"{",
"}",
",",
"response",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"err",
":=",
"client",
".",
"ensureProperties",
"(",
")",
";",
"err",
"... | // Invoke sends the raw HTTP request for ECS services | [
"Invoke",
"sends",
"the",
"raw",
"HTTP",
"request",
"for",
"ECS",
"services"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/common/client.go#L278-L353 |
30,098 | denverdino/aliyungo | ecs/route_tables.go | WaitForAllRouteEntriesAvailable | func (client *Client) WaitForAllRouteEntriesAvailable(vrouterId string, routeTableId string, timeout int) error {
if timeout <= 0 {
timeout = DefaultTimeout
}
args := DescribeRouteTablesArgs{
VRouterId: vrouterId,
RouteTableId: routeTableId,
}
for {
routeTables, _, err := client.DescribeRouteTables(&ar... | go | func (client *Client) WaitForAllRouteEntriesAvailable(vrouterId string, routeTableId string, timeout int) error {
if timeout <= 0 {
timeout = DefaultTimeout
}
args := DescribeRouteTablesArgs{
VRouterId: vrouterId,
RouteTableId: routeTableId,
}
for {
routeTables, _, err := client.DescribeRouteTables(&ar... | [
"func",
"(",
"client",
"*",
"Client",
")",
"WaitForAllRouteEntriesAvailable",
"(",
"vrouterId",
"string",
",",
"routeTableId",
"string",
",",
"timeout",
"int",
")",
"error",
"{",
"if",
"timeout",
"<=",
"0",
"{",
"timeout",
"=",
"DefaultTimeout",
"\n",
"}",
"... | // WaitForAllRouteEntriesAvailable waits for all route entries to Available status | [
"WaitForAllRouteEntriesAvailable",
"waits",
"for",
"all",
"route",
"entries",
"to",
"Available",
"status"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/ecs/route_tables.go#L147-L186 |
30,099 | denverdino/aliyungo | cs/client.go | NewClient | func NewClient(accessKeyId, accessKeySecret string) *Client {
return &Client{
AccessKeyId: accessKeyId,
AccessKeySecret: accessKeySecret,
endpoint: CSDefaultEndpoint,
Version: CSAPIVersion,
httpClient: &http.Client{},
}
} | go | func NewClient(accessKeyId, accessKeySecret string) *Client {
return &Client{
AccessKeyId: accessKeyId,
AccessKeySecret: accessKeySecret,
endpoint: CSDefaultEndpoint,
Version: CSAPIVersion,
httpClient: &http.Client{},
}
} | [
"func",
"NewClient",
"(",
"accessKeyId",
",",
"accessKeySecret",
"string",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"AccessKeyId",
":",
"accessKeyId",
",",
"AccessKeySecret",
":",
"accessKeySecret",
",",
"endpoint",
":",
"CSDefaultEndpoint",
",",
"... | // NewClient creates a new instance of CRM client | [
"NewClient",
"creates",
"a",
"new",
"instance",
"of",
"CRM",
"client"
] | 611ead8a6fedf409d6512b6e4f44f3f1cbc65755 | https://github.com/denverdino/aliyungo/blob/611ead8a6fedf409d6512b6e4f44f3f1cbc65755/cs/client.go#L48-L56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.