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 listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
125,300 | multiformats/go-multiaddr | multiaddr.go | String | func (m *multiaddr) String() string {
s, err := bytesToString(m.bytes)
if err != nil {
panic(fmt.Errorf("multiaddr failed to convert back to string. corrupted? %s", err))
}
return s
} | go | func (m *multiaddr) String() string {
s, err := bytesToString(m.bytes)
if err != nil {
panic(fmt.Errorf("multiaddr failed to convert back to string. corrupted? %s", err))
}
return s
} | [
"func",
"(",
"m",
"*",
"multiaddr",
")",
"String",
"(",
")",
"string",
"{",
"s",
",",
"err",
":=",
"bytesToString",
"(",
"m",
".",
"bytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err... | // String returns the string representation of a Multiaddr | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"a",
"Multiaddr"
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/multiaddr.go#L61-L67 |
125,301 | multiformats/go-multiaddr | multiaddr.go | Protocols | func (m *multiaddr) Protocols() []Protocol {
ps := make([]Protocol, 0, 8)
b := m.bytes
for len(b) > 0 {
code, n, err := ReadVarintCode(b)
if err != nil {
panic(err)
}
p := ProtocolWithCode(code)
if p.Code == 0 {
// this is a panic (and not returning err) because this should've been
// caught on c... | go | func (m *multiaddr) Protocols() []Protocol {
ps := make([]Protocol, 0, 8)
b := m.bytes
for len(b) > 0 {
code, n, err := ReadVarintCode(b)
if err != nil {
panic(err)
}
p := ProtocolWithCode(code)
if p.Code == 0 {
// this is a panic (and not returning err) because this should've been
// caught on c... | [
"func",
"(",
"m",
"*",
"multiaddr",
")",
"Protocols",
"(",
")",
"[",
"]",
"Protocol",
"{",
"ps",
":=",
"make",
"(",
"[",
"]",
"Protocol",
",",
"0",
",",
"8",
")",
"\n",
"b",
":=",
"m",
".",
"bytes",
"\n",
"for",
"len",
"(",
"b",
")",
">",
"... | // Protocols returns the list of protocols this Multiaddr has.
// will panic in case we access bytes incorrectly. | [
"Protocols",
"returns",
"the",
"list",
"of",
"protocols",
"this",
"Multiaddr",
"has",
".",
"will",
"panic",
"in",
"case",
"we",
"access",
"bytes",
"incorrectly",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/multiaddr.go#L111-L137 |
125,302 | multiformats/go-multiaddr | multiaddr.go | Encapsulate | func (m *multiaddr) Encapsulate(o Multiaddr) Multiaddr {
mb := m.bytes
ob := o.Bytes()
b := make([]byte, len(mb)+len(ob))
copy(b, mb)
copy(b[len(mb):], ob)
return &multiaddr{bytes: b}
} | go | func (m *multiaddr) Encapsulate(o Multiaddr) Multiaddr {
mb := m.bytes
ob := o.Bytes()
b := make([]byte, len(mb)+len(ob))
copy(b, mb)
copy(b[len(mb):], ob)
return &multiaddr{bytes: b}
} | [
"func",
"(",
"m",
"*",
"multiaddr",
")",
"Encapsulate",
"(",
"o",
"Multiaddr",
")",
"Multiaddr",
"{",
"mb",
":=",
"m",
".",
"bytes",
"\n",
"ob",
":=",
"o",
".",
"Bytes",
"(",
")",
"\n\n",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(... | // Encapsulate wraps a given Multiaddr, returning the resulting joined Multiaddr | [
"Encapsulate",
"wraps",
"a",
"given",
"Multiaddr",
"returning",
"the",
"resulting",
"joined",
"Multiaddr"
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/multiaddr.go#L140-L148 |
125,303 | multiformats/go-multiaddr | multiaddr.go | Decapsulate | func (m *multiaddr) Decapsulate(o Multiaddr) Multiaddr {
s1 := m.String()
s2 := o.String()
i := strings.LastIndex(s1, s2)
if i < 0 {
// if multiaddr not contained, returns a copy.
cpy := make([]byte, len(m.bytes))
copy(cpy, m.bytes)
return &multiaddr{bytes: cpy}
}
ma, err := NewMultiaddr(s1[:i])
if err ... | go | func (m *multiaddr) Decapsulate(o Multiaddr) Multiaddr {
s1 := m.String()
s2 := o.String()
i := strings.LastIndex(s1, s2)
if i < 0 {
// if multiaddr not contained, returns a copy.
cpy := make([]byte, len(m.bytes))
copy(cpy, m.bytes)
return &multiaddr{bytes: cpy}
}
ma, err := NewMultiaddr(s1[:i])
if err ... | [
"func",
"(",
"m",
"*",
"multiaddr",
")",
"Decapsulate",
"(",
"o",
"Multiaddr",
")",
"Multiaddr",
"{",
"s1",
":=",
"m",
".",
"String",
"(",
")",
"\n",
"s2",
":=",
"o",
".",
"String",
"(",
")",
"\n",
"i",
":=",
"strings",
".",
"LastIndex",
"(",
"s1... | // Decapsulate unwraps Multiaddr up until the given Multiaddr is found. | [
"Decapsulate",
"unwraps",
"Multiaddr",
"up",
"until",
"the",
"given",
"Multiaddr",
"is",
"found",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/multiaddr.go#L151-L167 |
125,304 | multiformats/go-multiaddr | util.go | Split | func Split(m Multiaddr) []Multiaddr {
if _, ok := m.(*Component); ok {
return []Multiaddr{m}
}
var addrs []Multiaddr
ForEach(m, func(c Component) bool {
addrs = append(addrs, &c)
return true
})
return addrs
} | go | func Split(m Multiaddr) []Multiaddr {
if _, ok := m.(*Component); ok {
return []Multiaddr{m}
}
var addrs []Multiaddr
ForEach(m, func(c Component) bool {
addrs = append(addrs, &c)
return true
})
return addrs
} | [
"func",
"Split",
"(",
"m",
"Multiaddr",
")",
"[",
"]",
"Multiaddr",
"{",
"if",
"_",
",",
"ok",
":=",
"m",
".",
"(",
"*",
"Component",
")",
";",
"ok",
"{",
"return",
"[",
"]",
"Multiaddr",
"{",
"m",
"}",
"\n",
"}",
"\n",
"var",
"addrs",
"[",
"... | // Split returns the sub-address portions of a multiaddr. | [
"Split",
"returns",
"the",
"sub",
"-",
"address",
"portions",
"of",
"a",
"multiaddr",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/util.go#L6-L16 |
125,305 | multiformats/go-multiaddr | util.go | Join | func Join(ms ...Multiaddr) Multiaddr {
switch len(ms) {
case 0:
// empty multiaddr, unfortunately, we have callers that rely on
// this contract.
return &multiaddr{}
case 1:
return ms[0]
}
length := 0
bs := make([][]byte, len(ms))
for i, m := range ms {
bs[i] = m.Bytes()
length += len(bs[i])
}
bi... | go | func Join(ms ...Multiaddr) Multiaddr {
switch len(ms) {
case 0:
// empty multiaddr, unfortunately, we have callers that rely on
// this contract.
return &multiaddr{}
case 1:
return ms[0]
}
length := 0
bs := make([][]byte, len(ms))
for i, m := range ms {
bs[i] = m.Bytes()
length += len(bs[i])
}
bi... | [
"func",
"Join",
"(",
"ms",
"...",
"Multiaddr",
")",
"Multiaddr",
"{",
"switch",
"len",
"(",
"ms",
")",
"{",
"case",
"0",
":",
"// empty multiaddr, unfortunately, we have callers that rely on",
"// this contract.",
"return",
"&",
"multiaddr",
"{",
"}",
"\n",
"case"... | // Join returns a combination of addresses. | [
"Join",
"returns",
"a",
"combination",
"of",
"addresses",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/util.go#L19-L42 |
125,306 | multiformats/go-multiaddr | util.go | Cast | func Cast(b []byte) Multiaddr {
m, err := NewMultiaddrBytes(b)
if err != nil {
panic(fmt.Errorf("multiaddr failed to parse: %s", err))
}
return m
} | go | func Cast(b []byte) Multiaddr {
m, err := NewMultiaddrBytes(b)
if err != nil {
panic(fmt.Errorf("multiaddr failed to parse: %s", err))
}
return m
} | [
"func",
"Cast",
"(",
"b",
"[",
"]",
"byte",
")",
"Multiaddr",
"{",
"m",
",",
"err",
":=",
"NewMultiaddrBytes",
"(",
"b",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
... | // Cast re-casts a byte slice as a multiaddr. will panic if it fails to parse. | [
"Cast",
"re",
"-",
"casts",
"a",
"byte",
"slice",
"as",
"a",
"multiaddr",
".",
"will",
"panic",
"if",
"it",
"fails",
"to",
"parse",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/util.go#L45-L51 |
125,307 | multiformats/go-multiaddr | util.go | StringCast | func StringCast(s string) Multiaddr {
m, err := NewMultiaddr(s)
if err != nil {
panic(fmt.Errorf("multiaddr failed to parse: %s", err))
}
return m
} | go | func StringCast(s string) Multiaddr {
m, err := NewMultiaddr(s)
if err != nil {
panic(fmt.Errorf("multiaddr failed to parse: %s", err))
}
return m
} | [
"func",
"StringCast",
"(",
"s",
"string",
")",
"Multiaddr",
"{",
"m",
",",
"err",
":=",
"NewMultiaddr",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\... | // StringCast like Cast, but parses a string. Will also panic if it fails to parse. | [
"StringCast",
"like",
"Cast",
"but",
"parses",
"a",
"string",
".",
"Will",
"also",
"panic",
"if",
"it",
"fails",
"to",
"parse",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/util.go#L54-L60 |
125,308 | multiformats/go-multiaddr | util.go | SplitFirst | func SplitFirst(m Multiaddr) (*Component, Multiaddr) {
// Shortcut if we already have a component
if c, ok := m.(*Component); ok {
return c, nil
}
b := m.Bytes()
if len(b) == 0 {
return nil, nil
}
n, c, err := readComponent(b)
if err != nil {
panic(err)
}
if len(b) == n {
return &c, nil
}
return &c... | go | func SplitFirst(m Multiaddr) (*Component, Multiaddr) {
// Shortcut if we already have a component
if c, ok := m.(*Component); ok {
return c, nil
}
b := m.Bytes()
if len(b) == 0 {
return nil, nil
}
n, c, err := readComponent(b)
if err != nil {
panic(err)
}
if len(b) == n {
return &c, nil
}
return &c... | [
"func",
"SplitFirst",
"(",
"m",
"Multiaddr",
")",
"(",
"*",
"Component",
",",
"Multiaddr",
")",
"{",
"// Shortcut if we already have a component",
"if",
"c",
",",
"ok",
":=",
"m",
".",
"(",
"*",
"Component",
")",
";",
"ok",
"{",
"return",
"c",
",",
"nil"... | // SplitFirst returns the first component and the rest of the multiaddr. | [
"SplitFirst",
"returns",
"the",
"first",
"component",
"and",
"the",
"rest",
"of",
"the",
"multiaddr",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/util.go#L63-L81 |
125,309 | multiformats/go-multiaddr | util.go | SplitLast | func SplitLast(m Multiaddr) (Multiaddr, *Component) {
// Shortcut if we already have a component
if c, ok := m.(*Component); ok {
return nil, c
}
b := m.Bytes()
if len(b) == 0 {
return nil, nil
}
var (
c Component
err error
offset int
)
for {
var n int
n, c, err = readComponent(b[offset... | go | func SplitLast(m Multiaddr) (Multiaddr, *Component) {
// Shortcut if we already have a component
if c, ok := m.(*Component); ok {
return nil, c
}
b := m.Bytes()
if len(b) == 0 {
return nil, nil
}
var (
c Component
err error
offset int
)
for {
var n int
n, c, err = readComponent(b[offset... | [
"func",
"SplitLast",
"(",
"m",
"Multiaddr",
")",
"(",
"Multiaddr",
",",
"*",
"Component",
")",
"{",
"// Shortcut if we already have a component",
"if",
"c",
",",
"ok",
":=",
"m",
".",
"(",
"*",
"Component",
")",
";",
"ok",
"{",
"return",
"nil",
",",
"c",... | // SplitLast returns the rest of the multiaddr and the last component. | [
"SplitLast",
"returns",
"the",
"rest",
"of",
"the",
"multiaddr",
"and",
"the",
"last",
"component",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/util.go#L84-L116 |
125,310 | multiformats/go-multiaddr | protocol.go | ProtocolsWithString | func ProtocolsWithString(s string) ([]Protocol, error) {
s = strings.Trim(s, "/")
sp := strings.Split(s, "/")
if len(sp) == 0 {
return nil, nil
}
t := make([]Protocol, len(sp))
for i, name := range sp {
p := ProtocolWithName(name)
if p.Code == 0 {
return nil, fmt.Errorf("no protocol with name: %s", name... | go | func ProtocolsWithString(s string) ([]Protocol, error) {
s = strings.Trim(s, "/")
sp := strings.Split(s, "/")
if len(sp) == 0 {
return nil, nil
}
t := make([]Protocol, len(sp))
for i, name := range sp {
p := ProtocolWithName(name)
if p.Code == 0 {
return nil, fmt.Errorf("no protocol with name: %s", name... | [
"func",
"ProtocolsWithString",
"(",
"s",
"string",
")",
"(",
"[",
"]",
"Protocol",
",",
"error",
")",
"{",
"s",
"=",
"strings",
".",
"Trim",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"sp",
":=",
"strings",
".",
"Split",
"(",
"s",
",",
"\"",
"\"",
"... | // ProtocolsWithString returns a slice of protocols matching given string. | [
"ProtocolsWithString",
"returns",
"a",
"slice",
"of",
"protocols",
"matching",
"given",
"string",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/protocol.go#L113-L129 |
125,311 | multiformats/go-multiaddr | component.go | writeTo | func (c *Component) writeTo(b *strings.Builder) {
b.WriteByte('/')
b.WriteString(c.protocol.Name)
value := c.Value()
if len(value) == 0 {
return
}
if !(c.protocol.Path && value[0] == '/') {
b.WriteByte('/')
}
b.WriteString(value)
} | go | func (c *Component) writeTo(b *strings.Builder) {
b.WriteByte('/')
b.WriteString(c.protocol.Name)
value := c.Value()
if len(value) == 0 {
return
}
if !(c.protocol.Path && value[0] == '/') {
b.WriteByte('/')
}
b.WriteString(value)
} | [
"func",
"(",
"c",
"*",
"Component",
")",
"writeTo",
"(",
"b",
"*",
"strings",
".",
"Builder",
")",
"{",
"b",
".",
"WriteByte",
"(",
"'/'",
")",
"\n",
"b",
".",
"WriteString",
"(",
"c",
".",
"protocol",
".",
"Name",
")",
"\n",
"value",
":=",
"c",
... | // writeTo is an efficient, private function for string-formatting a multiaddr.
// Trust me, we tend to allocate a lot when doing this. | [
"writeTo",
"is",
"an",
"efficient",
"private",
"function",
"for",
"string",
"-",
"formatting",
"a",
"multiaddr",
".",
"Trust",
"me",
"we",
"tend",
"to",
"allocate",
"a",
"lot",
"when",
"doing",
"this",
"."
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/component.go#L125-L136 |
125,312 | multiformats/go-multiaddr | component.go | NewComponent | func NewComponent(protocol, value string) (*Component, error) {
p := ProtocolWithName(protocol)
if p.Code == 0 {
return nil, fmt.Errorf("unsupported protocol: %s", protocol)
}
if p.Transcoder != nil {
bts, err := p.Transcoder.StringToBytes(value)
if err != nil {
return nil, err
}
return newComponent(p,... | go | func NewComponent(protocol, value string) (*Component, error) {
p := ProtocolWithName(protocol)
if p.Code == 0 {
return nil, fmt.Errorf("unsupported protocol: %s", protocol)
}
if p.Transcoder != nil {
bts, err := p.Transcoder.StringToBytes(value)
if err != nil {
return nil, err
}
return newComponent(p,... | [
"func",
"NewComponent",
"(",
"protocol",
",",
"value",
"string",
")",
"(",
"*",
"Component",
",",
"error",
")",
"{",
"p",
":=",
"ProtocolWithName",
"(",
"protocol",
")",
"\n",
"if",
"p",
".",
"Code",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
... | // NewComponent constructs a new multiaddr component | [
"NewComponent",
"constructs",
"a",
"new",
"multiaddr",
"component"
] | e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee | https://github.com/multiformats/go-multiaddr/blob/e1825f7b50d1dcebdaa28bc31a310fa2be4c00ee/component.go#L139-L155 |
125,313 | sebdah/goldie | goldie.go | compare | func compare(name string, data interface{}, actualData []byte) error {
expectedDataTmpl, err := ioutil.ReadFile(goldenFileName(name))
if err != nil {
if os.IsNotExist(err) {
return newErrFixtureNotFound()
}
return fmt.Errorf("Expected %s to be nil", err.Error())
}
tmpl, err := template.New("test").Parse... | go | func compare(name string, data interface{}, actualData []byte) error {
expectedDataTmpl, err := ioutil.ReadFile(goldenFileName(name))
if err != nil {
if os.IsNotExist(err) {
return newErrFixtureNotFound()
}
return fmt.Errorf("Expected %s to be nil", err.Error())
}
tmpl, err := template.New("test").Parse... | [
"func",
"compare",
"(",
"name",
"string",
",",
"data",
"interface",
"{",
"}",
",",
"actualData",
"[",
"]",
"byte",
")",
"error",
"{",
"expectedDataTmpl",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"goldenFileName",
"(",
"name",
")",
")",
"\n\n",
... | // compare is reading the golden fixture file and compare the stored data with
// the actual data. | [
"compare",
"is",
"reading",
"the",
"golden",
"fixture",
"file",
"and",
"compare",
"the",
"stored",
"data",
"with",
"the",
"actual",
"data",
"."
] | 629351c67c535d23e79162543d4ed21e32449d68 | https://github.com/sebdah/goldie/blob/629351c67c535d23e79162543d4ed21e32449d68/goldie.go#L101-L133 |
125,314 | sebdah/goldie | goldie.go | ensureDir | func ensureDir(loc string) error {
s, err := os.Stat(loc)
switch {
case err != nil && os.IsNotExist(err):
// the location does not exist, so make directories to there
return os.MkdirAll(loc, DirPerms)
case err == nil && !s.IsDir():
return newErrFixtureDirectoryIsFile(loc)
}
return err
} | go | func ensureDir(loc string) error {
s, err := os.Stat(loc)
switch {
case err != nil && os.IsNotExist(err):
// the location does not exist, so make directories to there
return os.MkdirAll(loc, DirPerms)
case err == nil && !s.IsDir():
return newErrFixtureDirectoryIsFile(loc)
}
return err
} | [
"func",
"ensureDir",
"(",
"loc",
"string",
")",
"error",
"{",
"s",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"loc",
")",
"\n",
"switch",
"{",
"case",
"err",
"!=",
"nil",
"&&",
"os",
".",
"IsNotExist",
"(",
"err",
")",
":",
"// the location does not e... | // ensureDir will create the fixture folder if it does not already exist. | [
"ensureDir",
"will",
"create",
"the",
"fixture",
"folder",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] | 629351c67c535d23e79162543d4ed21e32449d68 | https://github.com/sebdah/goldie/blob/629351c67c535d23e79162543d4ed21e32449d68/goldie.go#L136-L147 |
125,315 | sebdah/goldie | goldie.go | goldenFileName | func goldenFileName(name string) string {
return filepath.Join(FixtureDir, fmt.Sprintf("%s%s", name, FileNameSuffix))
} | go | func goldenFileName(name string) string {
return filepath.Join(FixtureDir, fmt.Sprintf("%s%s", name, FileNameSuffix))
} | [
"func",
"goldenFileName",
"(",
"name",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"FixtureDir",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
",",
"FileNameSuffix",
")",
")",
"\n",
"}"
] | // goldenFileName simply returns the file name of the golden file fixture. | [
"goldenFileName",
"simply",
"returns",
"the",
"file",
"name",
"of",
"the",
"golden",
"file",
"fixture",
"."
] | 629351c67c535d23e79162543d4ed21e32449d68 | https://github.com/sebdah/goldie/blob/629351c67c535d23e79162543d4ed21e32449d68/goldie.go#L150-L152 |
125,316 | beefsack/go-rate | rate.go | New | func New(limit int, interval time.Duration) *RateLimiter {
lim := &RateLimiter{
limit: limit,
interval: interval,
}
lim.times.Init()
return lim
} | go | func New(limit int, interval time.Duration) *RateLimiter {
lim := &RateLimiter{
limit: limit,
interval: interval,
}
lim.times.Init()
return lim
} | [
"func",
"New",
"(",
"limit",
"int",
",",
"interval",
"time",
".",
"Duration",
")",
"*",
"RateLimiter",
"{",
"lim",
":=",
"&",
"RateLimiter",
"{",
"limit",
":",
"limit",
",",
"interval",
":",
"interval",
",",
"}",
"\n",
"lim",
".",
"times",
".",
"Init... | // New creates a new rate limiter for the limit and interval. | [
"New",
"creates",
"a",
"new",
"rate",
"limiter",
"for",
"the",
"limit",
"and",
"interval",
"."
] | efa7637bb9b6433f47eb73dde68902abda87f352 | https://github.com/beefsack/go-rate/blob/efa7637bb9b6433f47eb73dde68902abda87f352/rate.go#L22-L29 |
125,317 | beefsack/go-rate | rate.go | Wait | func (r *RateLimiter) Wait() {
for {
ok, remaining := r.Try()
if ok {
break
}
time.Sleep(remaining)
}
} | go | func (r *RateLimiter) Wait() {
for {
ok, remaining := r.Try()
if ok {
break
}
time.Sleep(remaining)
}
} | [
"func",
"(",
"r",
"*",
"RateLimiter",
")",
"Wait",
"(",
")",
"{",
"for",
"{",
"ok",
",",
"remaining",
":=",
"r",
".",
"Try",
"(",
")",
"\n",
"if",
"ok",
"{",
"break",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"remaining",
")",
"\n",
"}",
"\... | // Wait blocks if the rate limit has been reached. Wait offers no guarantees
// of fairness for multiple actors if the allowed rate has been temporarily
// exhausted. | [
"Wait",
"blocks",
"if",
"the",
"rate",
"limit",
"has",
"been",
"reached",
".",
"Wait",
"offers",
"no",
"guarantees",
"of",
"fairness",
"for",
"multiple",
"actors",
"if",
"the",
"allowed",
"rate",
"has",
"been",
"temporarily",
"exhausted",
"."
] | efa7637bb9b6433f47eb73dde68902abda87f352 | https://github.com/beefsack/go-rate/blob/efa7637bb9b6433f47eb73dde68902abda87f352/rate.go#L34-L42 |
125,318 | beefsack/go-rate | rate.go | Try | func (r *RateLimiter) Try() (ok bool, remaining time.Duration) {
r.mtx.Lock()
defer r.mtx.Unlock()
now := time.Now()
if l := r.times.Len(); l < r.limit {
r.times.PushBack(now)
return true, 0
}
frnt := r.times.Front()
if diff := now.Sub(frnt.Value.(time.Time)); diff < r.interval {
return false, r.interval -... | go | func (r *RateLimiter) Try() (ok bool, remaining time.Duration) {
r.mtx.Lock()
defer r.mtx.Unlock()
now := time.Now()
if l := r.times.Len(); l < r.limit {
r.times.PushBack(now)
return true, 0
}
frnt := r.times.Front()
if diff := now.Sub(frnt.Value.(time.Time)); diff < r.interval {
return false, r.interval -... | [
"func",
"(",
"r",
"*",
"RateLimiter",
")",
"Try",
"(",
")",
"(",
"ok",
"bool",
",",
"remaining",
"time",
".",
"Duration",
")",
"{",
"r",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"now",
... | // Try returns true if under the rate limit, or false if over and the
// remaining time before the rate limit expires. | [
"Try",
"returns",
"true",
"if",
"under",
"the",
"rate",
"limit",
"or",
"false",
"if",
"over",
"and",
"the",
"remaining",
"time",
"before",
"the",
"rate",
"limit",
"expires",
"."
] | efa7637bb9b6433f47eb73dde68902abda87f352 | https://github.com/beefsack/go-rate/blob/efa7637bb9b6433f47eb73dde68902abda87f352/rate.go#L46-L61 |
125,319 | bgentry/que-go | que.go | Done | func (j *Job) Done() {
j.mu.Lock()
defer j.mu.Unlock()
if j.conn == nil || j.pool == nil {
// already marked as done
return
}
var ok bool
// Swallow this error because we don't want an unlock failure to cause work to
// stop.
_ = j.conn.QueryRow("que_unlock_job", j.ID).Scan(&ok)
j.pool.Release(j.conn)
... | go | func (j *Job) Done() {
j.mu.Lock()
defer j.mu.Unlock()
if j.conn == nil || j.pool == nil {
// already marked as done
return
}
var ok bool
// Swallow this error because we don't want an unlock failure to cause work to
// stop.
_ = j.conn.QueryRow("que_unlock_job", j.ID).Scan(&ok)
j.pool.Release(j.conn)
... | [
"func",
"(",
"j",
"*",
"Job",
")",
"Done",
"(",
")",
"{",
"j",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"j",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"j",
".",
"conn",
"==",
"nil",
"||",
"j",
".",
"pool",
"==",
"nil",
"{"... | // Done releases the Postgres advisory lock on the job and returns the database
// connection to the pool. | [
"Done",
"releases",
"the",
"Postgres",
"advisory",
"lock",
"on",
"the",
"job",
"and",
"returns",
"the",
"database",
"connection",
"to",
"the",
"pool",
"."
] | b198c7caf054cfc10e9da6b34f33364d80464425 | https://github.com/bgentry/que-go/blob/b198c7caf054cfc10e9da6b34f33364d80464425/que.go#L86-L103 |
125,320 | bgentry/que-go | que.go | Enqueue | func (c *Client) Enqueue(j *Job) error {
return execEnqueue(j, c.pool)
} | go | func (c *Client) Enqueue(j *Job) error {
return execEnqueue(j, c.pool)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Enqueue",
"(",
"j",
"*",
"Job",
")",
"error",
"{",
"return",
"execEnqueue",
"(",
"j",
",",
"c",
".",
"pool",
")",
"\n",
"}"
] | // Enqueue adds a job to the queue. | [
"Enqueue",
"adds",
"a",
"job",
"to",
"the",
"queue",
"."
] | b198c7caf054cfc10e9da6b34f33364d80464425 | https://github.com/bgentry/que-go/blob/b198c7caf054cfc10e9da6b34f33364d80464425/que.go#L140-L142 |
125,321 | bgentry/que-go | que.go | EnqueueInTx | func (c *Client) EnqueueInTx(j *Job, tx *pgx.Tx) error {
return execEnqueue(j, tx)
} | go | func (c *Client) EnqueueInTx(j *Job, tx *pgx.Tx) error {
return execEnqueue(j, tx)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"EnqueueInTx",
"(",
"j",
"*",
"Job",
",",
"tx",
"*",
"pgx",
".",
"Tx",
")",
"error",
"{",
"return",
"execEnqueue",
"(",
"j",
",",
"tx",
")",
"\n",
"}"
] | // EnqueueInTx adds a job to the queue within the scope of the transaction tx.
// This allows you to guarantee that an enqueued job will either be committed or
// rolled back atomically with other changes in the course of this transaction.
//
// It is the caller's responsibility to Commit or Rollback the transaction af... | [
"EnqueueInTx",
"adds",
"a",
"job",
"to",
"the",
"queue",
"within",
"the",
"scope",
"of",
"the",
"transaction",
"tx",
".",
"This",
"allows",
"you",
"to",
"guarantee",
"that",
"an",
"enqueued",
"job",
"will",
"either",
"be",
"committed",
"or",
"rolled",
"bac... | b198c7caf054cfc10e9da6b34f33364d80464425 | https://github.com/bgentry/que-go/blob/b198c7caf054cfc10e9da6b34f33364d80464425/que.go#L150-L152 |
125,322 | bgentry/que-go | worker.go | Shutdown | func (w *Worker) Shutdown() {
w.mu.Lock()
defer w.mu.Unlock()
if w.done {
return
}
log.Println("worker shutting down gracefully...")
w.ch <- struct{}{}
w.done = true
close(w.ch)
} | go | func (w *Worker) Shutdown() {
w.mu.Lock()
defer w.mu.Unlock()
if w.done {
return
}
log.Println("worker shutting down gracefully...")
w.ch <- struct{}{}
w.done = true
close(w.ch)
} | [
"func",
"(",
"w",
"*",
"Worker",
")",
"Shutdown",
"(",
")",
"{",
"w",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"w",
".",
"done",
"{",
"return",
"\n",
"}",
"\n\n",
"log",
".",
"P... | // Shutdown tells the worker to finish processing its current job and then stop.
// There is currently no timeout for in-progress jobs. This function blocks
// until the Worker has stopped working. It should only be called on an active
// Worker. | [
"Shutdown",
"tells",
"the",
"worker",
"to",
"finish",
"processing",
"its",
"current",
"job",
"and",
"then",
"stop",
".",
"There",
"is",
"currently",
"no",
"timeout",
"for",
"in",
"-",
"progress",
"jobs",
".",
"This",
"function",
"blocks",
"until",
"the",
"... | b198c7caf054cfc10e9da6b34f33364d80464425 | https://github.com/bgentry/que-go/blob/b198c7caf054cfc10e9da6b34f33364d80464425/worker.go#L128-L140 |
125,323 | bgentry/que-go | worker.go | recoverPanic | func recoverPanic(j *Job) {
if r := recover(); r != nil {
// record an error on the job with panic message and stacktrace
stackBuf := make([]byte, 1024)
n := runtime.Stack(stackBuf, false)
buf := &bytes.Buffer{}
fmt.Fprintf(buf, "%v\n", r)
fmt.Fprintln(buf, string(stackBuf[:n]))
fmt.Fprintln(buf, "[...]... | go | func recoverPanic(j *Job) {
if r := recover(); r != nil {
// record an error on the job with panic message and stacktrace
stackBuf := make([]byte, 1024)
n := runtime.Stack(stackBuf, false)
buf := &bytes.Buffer{}
fmt.Fprintf(buf, "%v\n", r)
fmt.Fprintln(buf, string(stackBuf[:n]))
fmt.Fprintln(buf, "[...]... | [
"func",
"recoverPanic",
"(",
"j",
"*",
"Job",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"// record an error on the job with panic message and stacktrace",
"stackBuf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"1024",
")",
... | // recoverPanic tries to handle panics in job execution.
// A stacktrace is stored into Job last_error. | [
"recoverPanic",
"tries",
"to",
"handle",
"panics",
"in",
"job",
"execution",
".",
"A",
"stacktrace",
"is",
"stored",
"into",
"Job",
"last_error",
"."
] | b198c7caf054cfc10e9da6b34f33364d80464425 | https://github.com/bgentry/que-go/blob/b198c7caf054cfc10e9da6b34f33364d80464425/worker.go#L144-L160 |
125,324 | bgentry/que-go | worker.go | NewWorkerPool | func NewWorkerPool(c *Client, wm WorkMap, count int) *WorkerPool {
return &WorkerPool{
c: c,
WorkMap: wm,
Interval: defaultWakeInterval,
workers: make([]*Worker, count),
}
} | go | func NewWorkerPool(c *Client, wm WorkMap, count int) *WorkerPool {
return &WorkerPool{
c: c,
WorkMap: wm,
Interval: defaultWakeInterval,
workers: make([]*Worker, count),
}
} | [
"func",
"NewWorkerPool",
"(",
"c",
"*",
"Client",
",",
"wm",
"WorkMap",
",",
"count",
"int",
")",
"*",
"WorkerPool",
"{",
"return",
"&",
"WorkerPool",
"{",
"c",
":",
"c",
",",
"WorkMap",
":",
"wm",
",",
"Interval",
":",
"defaultWakeInterval",
",",
"wor... | // NewWorkerPool creates a new WorkerPool with count workers using the Client c. | [
"NewWorkerPool",
"creates",
"a",
"new",
"WorkerPool",
"with",
"count",
"workers",
"using",
"the",
"Client",
"c",
"."
] | b198c7caf054cfc10e9da6b34f33364d80464425 | https://github.com/bgentry/que-go/blob/b198c7caf054cfc10e9da6b34f33364d80464425/worker.go#L176-L183 |
125,325 | bgentry/que-go | worker.go | Start | func (w *WorkerPool) Start() {
w.mu.Lock()
defer w.mu.Unlock()
for i := range w.workers {
w.workers[i] = NewWorker(w.c, w.WorkMap)
w.workers[i].Interval = w.Interval
w.workers[i].Queue = w.Queue
go w.workers[i].Work()
}
} | go | func (w *WorkerPool) Start() {
w.mu.Lock()
defer w.mu.Unlock()
for i := range w.workers {
w.workers[i] = NewWorker(w.c, w.WorkMap)
w.workers[i].Interval = w.Interval
w.workers[i].Queue = w.Queue
go w.workers[i].Work()
}
} | [
"func",
"(",
"w",
"*",
"WorkerPool",
")",
"Start",
"(",
")",
"{",
"w",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"i",
":=",
"range",
"w",
".",
"workers",
"{",
"w",
".",
"workers",... | // Start starts all of the Workers in the WorkerPool. | [
"Start",
"starts",
"all",
"of",
"the",
"Workers",
"in",
"the",
"WorkerPool",
"."
] | b198c7caf054cfc10e9da6b34f33364d80464425 | https://github.com/bgentry/que-go/blob/b198c7caf054cfc10e9da6b34f33364d80464425/worker.go#L186-L196 |
125,326 | bgentry/que-go | worker.go | Shutdown | func (w *WorkerPool) Shutdown() {
w.mu.Lock()
defer w.mu.Unlock()
if w.done {
return
}
var wg sync.WaitGroup
wg.Add(len(w.workers))
for _, worker := range w.workers {
go func(worker *Worker) {
worker.Shutdown()
wg.Done()
}(worker)
}
wg.Wait()
w.done = true
} | go | func (w *WorkerPool) Shutdown() {
w.mu.Lock()
defer w.mu.Unlock()
if w.done {
return
}
var wg sync.WaitGroup
wg.Add(len(w.workers))
for _, worker := range w.workers {
go func(worker *Worker) {
worker.Shutdown()
wg.Done()
}(worker)
}
wg.Wait()
w.done = true
} | [
"func",
"(",
"w",
"*",
"WorkerPool",
")",
"Shutdown",
"(",
")",
"{",
"w",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"w",
".",
"done",
"{",
"return",
"\n",
"}",
"\n",
"var",
"wg",
... | // Shutdown sends a Shutdown signal to each of the Workers in the WorkerPool and
// waits for them all to finish shutting down. | [
"Shutdown",
"sends",
"a",
"Shutdown",
"signal",
"to",
"each",
"of",
"the",
"Workers",
"in",
"the",
"WorkerPool",
"and",
"waits",
"for",
"them",
"all",
"to",
"finish",
"shutting",
"down",
"."
] | b198c7caf054cfc10e9da6b34f33364d80464425 | https://github.com/bgentry/que-go/blob/b198c7caf054cfc10e9da6b34f33364d80464425/worker.go#L200-L218 |
125,327 | plimble/ace | context.go | HTML | func (c *C) HTML(name string, data interface{}) {
c.render.Render(c.Writer, name, data)
} | go | func (c *C) HTML(name string, data interface{}) {
c.render.Render(c.Writer, name, data)
} | [
"func",
"(",
"c",
"*",
"C",
")",
"HTML",
"(",
"name",
"string",
",",
"data",
"interface",
"{",
"}",
")",
"{",
"c",
".",
"render",
".",
"Render",
"(",
"c",
".",
"Writer",
",",
"name",
",",
"data",
")",
"\n",
"}"
] | //HTML render template engine | [
"HTML",
"render",
"template",
"engine"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/context.go#L88-L90 |
125,328 | plimble/ace | context.go | Param | func (c *C) Param(name string) string {
return c.params.ByName(name)
} | go | func (c *C) Param(name string) string {
return c.params.ByName(name)
} | [
"func",
"(",
"c",
"*",
"C",
")",
"Param",
"(",
"name",
"string",
")",
"string",
"{",
"return",
"c",
".",
"params",
".",
"ByName",
"(",
"name",
")",
"\n",
"}"
] | //Param get param from route | [
"Param",
"get",
"param",
"from",
"route"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/context.go#L93-L95 |
125,329 | plimble/ace | context.go | HTTPLang | func (c *C) HTTPLang() string {
langStr := c.Request.Header.Get(acceptLanguage)
return strings.Split(langStr, ",")[0]
} | go | func (c *C) HTTPLang() string {
langStr := c.Request.Header.Get(acceptLanguage)
return strings.Split(langStr, ",")[0]
} | [
"func",
"(",
"c",
"*",
"C",
")",
"HTTPLang",
"(",
")",
"string",
"{",
"langStr",
":=",
"c",
".",
"Request",
".",
"Header",
".",
"Get",
"(",
"acceptLanguage",
")",
"\n",
"return",
"strings",
".",
"Split",
"(",
"langStr",
",",
"\"",
"\"",
")",
"[",
... | //HTTPLang get first language from HTTP Header | [
"HTTPLang",
"get",
"first",
"language",
"from",
"HTTP",
"Header"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/context.go#L104-L107 |
125,330 | plimble/ace | context.go | Redirect | func (c *C) Redirect(url string) {
http.Redirect(c.Writer, c.Request, url, 302)
} | go | func (c *C) Redirect(url string) {
http.Redirect(c.Writer, c.Request, url, 302)
} | [
"func",
"(",
"c",
"*",
"C",
")",
"Redirect",
"(",
"url",
"string",
")",
"{",
"http",
".",
"Redirect",
"(",
"c",
".",
"Writer",
",",
"c",
".",
"Request",
",",
"url",
",",
"302",
")",
"\n",
"}"
] | //Redirect 302 response | [
"Redirect",
"302",
"response"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/context.go#L110-L112 |
125,331 | plimble/ace | context.go | AbortWithStatus | func (c *C) AbortWithStatus(status int) {
c.Writer.WriteHeader(status)
c.Abort()
} | go | func (c *C) AbortWithStatus(status int) {
c.Writer.WriteHeader(status)
c.Abort()
} | [
"func",
"(",
"c",
"*",
"C",
")",
"AbortWithStatus",
"(",
"status",
"int",
")",
"{",
"c",
".",
"Writer",
".",
"WriteHeader",
"(",
"status",
")",
"\n",
"c",
".",
"Abort",
"(",
")",
"\n",
"}"
] | //AbortWithStatus stop maddileware and return http status code | [
"AbortWithStatus",
"stop",
"maddileware",
"and",
"return",
"http",
"status",
"code"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/context.go#L120-L123 |
125,332 | plimble/ace | context.go | Next | func (c *C) Next() {
c.index++
s := int8(len(c.handlers))
if c.index < s {
c.handlers[c.index](c)
}
} | go | func (c *C) Next() {
c.index++
s := int8(len(c.handlers))
if c.index < s {
c.handlers[c.index](c)
}
} | [
"func",
"(",
"c",
"*",
"C",
")",
"Next",
"(",
")",
"{",
"c",
".",
"index",
"++",
"\n",
"s",
":=",
"int8",
"(",
"len",
"(",
"c",
".",
"handlers",
")",
")",
"\n",
"if",
"c",
".",
"index",
"<",
"s",
"{",
"c",
".",
"handlers",
"[",
"c",
".",
... | //Next next middleware | [
"Next",
"next",
"middleware"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/context.go#L126-L132 |
125,333 | plimble/ace | ace.go | Run | func (a *Ace) Run(addr string) {
if err := http.ListenAndServe(addr, a); err != nil {
panic(err)
}
} | go | func (a *Ace) Run(addr string) {
if err := http.ListenAndServe(addr, a); err != nil {
panic(err)
}
} | [
"func",
"(",
"a",
"*",
"Ace",
")",
"Run",
"(",
"addr",
"string",
")",
"{",
"if",
"err",
":=",
"http",
".",
"ListenAndServe",
"(",
"addr",
",",
"a",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] | //Run server with specific address and port | [
"Run",
"server",
"with",
"specific",
"address",
"and",
"port"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/ace.go#L74-L78 |
125,334 | plimble/ace | ace.go | RunTLS | func (a *Ace) RunTLS(addr string, cert string, key string) {
if err := http.ListenAndServeTLS(addr, cert, key, a); err != nil {
panic(err)
}
} | go | func (a *Ace) RunTLS(addr string, cert string, key string) {
if err := http.ListenAndServeTLS(addr, cert, key, a); err != nil {
panic(err)
}
} | [
"func",
"(",
"a",
"*",
"Ace",
")",
"RunTLS",
"(",
"addr",
"string",
",",
"cert",
"string",
",",
"key",
"string",
")",
"{",
"if",
"err",
":=",
"http",
".",
"ListenAndServeTLS",
"(",
"addr",
",",
"cert",
",",
"key",
",",
"a",
")",
";",
"err",
"!=",... | //RunTLS server with specific address and port | [
"RunTLS",
"server",
"with",
"specific",
"address",
"and",
"port"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/ace.go#L81-L85 |
125,335 | plimble/ace | ace.go | ServeHTTP | func (a *Ace) ServeHTTP(w http.ResponseWriter, req *http.Request) {
a.httprouter.ServeHTTP(w, req)
} | go | func (a *Ace) ServeHTTP(w http.ResponseWriter, req *http.Request) {
a.httprouter.ServeHTTP(w, req)
} | [
"func",
"(",
"a",
"*",
"Ace",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"a",
".",
"httprouter",
".",
"ServeHTTP",
"(",
"w",
",",
"req",
")",
"\n",
"}"
] | //ServeHTTP implement http.Handler | [
"ServeHTTP",
"implement",
"http",
".",
"Handler"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/ace.go#L88-L90 |
125,336 | plimble/ace | session.go | Session | func Session(store sessions.Store, options *SessionOptions) HandlerFunc {
var sessionOptions *sessions.Options
if options != nil {
sessionOptions = &sessions.Options{
Path: options.Path,
Domain: options.Domain,
MaxAge: options.MaxAge,
Secure: options.Secure,
HttpOnly: options.HTTPOnly,
}... | go | func Session(store sessions.Store, options *SessionOptions) HandlerFunc {
var sessionOptions *sessions.Options
if options != nil {
sessionOptions = &sessions.Options{
Path: options.Path,
Domain: options.Domain,
MaxAge: options.MaxAge,
Secure: options.Secure,
HttpOnly: options.HTTPOnly,
}... | [
"func",
"Session",
"(",
"store",
"sessions",
".",
"Store",
",",
"options",
"*",
"SessionOptions",
")",
"HandlerFunc",
"{",
"var",
"sessionOptions",
"*",
"sessions",
".",
"Options",
"\n\n",
"if",
"options",
"!=",
"nil",
"{",
"sessionOptions",
"=",
"&",
"sessi... | //Session use session middleware | [
"Session",
"use",
"session",
"middleware"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/session.go#L20-L45 |
125,337 | plimble/ace | router.go | Use | func (r *Router) Use(middlewares ...HandlerFunc) {
for _, handler := range middlewares {
r.handlers = append(r.handlers, handler)
}
} | go | func (r *Router) Use(middlewares ...HandlerFunc) {
for _, handler := range middlewares {
r.handlers = append(r.handlers, handler)
}
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"Use",
"(",
"middlewares",
"...",
"HandlerFunc",
")",
"{",
"for",
"_",
",",
"handler",
":=",
"range",
"middlewares",
"{",
"r",
".",
"handlers",
"=",
"append",
"(",
"r",
".",
"handlers",
",",
"handler",
")",
"\n",... | //Use register middleware | [
"Use",
"register",
"middleware"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L27-L31 |
125,338 | plimble/ace | router.go | GET | func (r *Router) GET(path string, handlers ...HandlerFunc) {
r.Handle("GET", path, handlers)
} | go | func (r *Router) GET(path string, handlers ...HandlerFunc) {
r.Handle("GET", path, handlers)
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"GET",
"(",
"path",
"string",
",",
"handlers",
"...",
"HandlerFunc",
")",
"{",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"path",
",",
"handlers",
")",
"\n",
"}"
] | //GET handle GET method | [
"GET",
"handle",
"GET",
"method"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L34-L36 |
125,339 | plimble/ace | router.go | POST | func (r *Router) POST(path string, handlers ...HandlerFunc) {
r.Handle("POST", path, handlers)
} | go | func (r *Router) POST(path string, handlers ...HandlerFunc) {
r.Handle("POST", path, handlers)
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"POST",
"(",
"path",
"string",
",",
"handlers",
"...",
"HandlerFunc",
")",
"{",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"path",
",",
"handlers",
")",
"\n",
"}"
] | //POST handle POST method | [
"POST",
"handle",
"POST",
"method"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L39-L41 |
125,340 | plimble/ace | router.go | PATCH | func (r *Router) PATCH(path string, handlers ...HandlerFunc) {
r.Handle("PATCH", path, handlers)
} | go | func (r *Router) PATCH(path string, handlers ...HandlerFunc) {
r.Handle("PATCH", path, handlers)
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"PATCH",
"(",
"path",
"string",
",",
"handlers",
"...",
"HandlerFunc",
")",
"{",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"path",
",",
"handlers",
")",
"\n",
"}"
] | //PATCH handle PATCH method | [
"PATCH",
"handle",
"PATCH",
"method"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L44-L46 |
125,341 | plimble/ace | router.go | PUT | func (r *Router) PUT(path string, handlers ...HandlerFunc) {
r.Handle("PUT", path, handlers)
} | go | func (r *Router) PUT(path string, handlers ...HandlerFunc) {
r.Handle("PUT", path, handlers)
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"PUT",
"(",
"path",
"string",
",",
"handlers",
"...",
"HandlerFunc",
")",
"{",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"path",
",",
"handlers",
")",
"\n",
"}"
] | //PUT handle PUT method | [
"PUT",
"handle",
"PUT",
"method"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L49-L51 |
125,342 | plimble/ace | router.go | DELETE | func (r *Router) DELETE(path string, handlers ...HandlerFunc) {
r.Handle("DELETE", path, handlers)
} | go | func (r *Router) DELETE(path string, handlers ...HandlerFunc) {
r.Handle("DELETE", path, handlers)
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"DELETE",
"(",
"path",
"string",
",",
"handlers",
"...",
"HandlerFunc",
")",
"{",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"path",
",",
"handlers",
")",
"\n",
"}"
] | //DELETE handle DELETE method | [
"DELETE",
"handle",
"DELETE",
"method"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L54-L56 |
125,343 | plimble/ace | router.go | HEAD | func (r *Router) HEAD(path string, handlers ...HandlerFunc) {
r.Handle("HEAD", path, handlers)
} | go | func (r *Router) HEAD(path string, handlers ...HandlerFunc) {
r.Handle("HEAD", path, handlers)
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"HEAD",
"(",
"path",
"string",
",",
"handlers",
"...",
"HandlerFunc",
")",
"{",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"path",
",",
"handlers",
")",
"\n",
"}"
] | //HEAD handle HEAD method | [
"HEAD",
"handle",
"HEAD",
"method"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L59-L61 |
125,344 | plimble/ace | router.go | OPTIONS | func (r *Router) OPTIONS(path string, handlers ...HandlerFunc) {
r.Handle("OPTIONS", path, handlers)
} | go | func (r *Router) OPTIONS(path string, handlers ...HandlerFunc) {
r.Handle("OPTIONS", path, handlers)
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"OPTIONS",
"(",
"path",
"string",
",",
"handlers",
"...",
"HandlerFunc",
")",
"{",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"path",
",",
"handlers",
")",
"\n",
"}"
] | //OPTIONS handle OPTIONS method | [
"OPTIONS",
"handle",
"OPTIONS",
"method"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L64-L66 |
125,345 | plimble/ace | router.go | Group | func (r *Router) Group(path string, handlers ...HandlerFunc) *Router {
handlers = r.combineHandlers(handlers)
return &Router{
handlers: handlers,
prefix: r.path(path),
ace: r.ace,
}
} | go | func (r *Router) Group(path string, handlers ...HandlerFunc) *Router {
handlers = r.combineHandlers(handlers)
return &Router{
handlers: handlers,
prefix: r.path(path),
ace: r.ace,
}
} | [
"func",
"(",
"r",
"*",
"Router",
")",
"Group",
"(",
"path",
"string",
",",
"handlers",
"...",
"HandlerFunc",
")",
"*",
"Router",
"{",
"handlers",
"=",
"r",
".",
"combineHandlers",
"(",
"handlers",
")",
"\n",
"return",
"&",
"Router",
"{",
"handlers",
":... | //Group group route | [
"Group",
"group",
"route"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L69-L76 |
125,346 | plimble/ace | router.go | Static | func (r *Router) Static(path string, root http.Dir, handlers ...HandlerFunc) {
path = r.path(path)
fileServer := http.StripPrefix(path, http.FileServer(root))
handlers = append(handlers, func(c *C) {
fileServer.ServeHTTP(c.Writer, c.Request)
})
r.ace.httprouter.Handle("GET", r.staticPath(path), func(w http.Res... | go | func (r *Router) Static(path string, root http.Dir, handlers ...HandlerFunc) {
path = r.path(path)
fileServer := http.StripPrefix(path, http.FileServer(root))
handlers = append(handlers, func(c *C) {
fileServer.ServeHTTP(c.Writer, c.Request)
})
r.ace.httprouter.Handle("GET", r.staticPath(path), func(w http.Res... | [
"func",
"(",
"r",
"*",
"Router",
")",
"Static",
"(",
"path",
"string",
",",
"root",
"http",
".",
"Dir",
",",
"handlers",
"...",
"HandlerFunc",
")",
"{",
"path",
"=",
"r",
".",
"path",
"(",
"path",
")",
"\n",
"fileServer",
":=",
"http",
".",
"StripP... | //Static server static file
//path is url path
//root is root directory | [
"Static",
"server",
"static",
"file",
"path",
"is",
"url",
"path",
"root",
"is",
"root",
"directory"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L109-L123 |
125,347 | plimble/ace | router.go | Handle | func (r *Router) Handle(method, path string, handlers []HandlerFunc) {
handlers = r.combineHandlers(handlers)
r.ace.httprouter.Handle(method, r.path(path), func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
c := r.ace.createContext(w, req)
c.params = params
c.handlers = handlers
c.Next... | go | func (r *Router) Handle(method, path string, handlers []HandlerFunc) {
handlers = r.combineHandlers(handlers)
r.ace.httprouter.Handle(method, r.path(path), func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
c := r.ace.createContext(w, req)
c.params = params
c.handlers = handlers
c.Next... | [
"func",
"(",
"r",
"*",
"Router",
")",
"Handle",
"(",
"method",
",",
"path",
"string",
",",
"handlers",
"[",
"]",
"HandlerFunc",
")",
"{",
"handlers",
"=",
"r",
".",
"combineHandlers",
"(",
"handlers",
")",
"\n",
"r",
".",
"ace",
".",
"httprouter",
".... | //Handle handle with specific method | [
"Handle",
"handle",
"with",
"specific",
"method"
] | ba79f505f4167588c521eae1f7691fdf360a574a | https://github.com/plimble/ace/blob/ba79f505f4167588c521eae1f7691fdf360a574a/router.go#L126-L135 |
125,348 | rafaeljesus/rabbus | rabbus.go | New | func New(dsn string, options ...Option) (*Rabbus, error) {
r := &Rabbus{
emit: make(chan Message),
emitErr: make(chan error),
emitOk: make(chan struct{}),
reconn: make(chan struct{}),
exDeclared: make(map[string]struct{}),
}
for _, o := range options {
if err := o(r); err != nil {
re... | go | func New(dsn string, options ...Option) (*Rabbus, error) {
r := &Rabbus{
emit: make(chan Message),
emitErr: make(chan error),
emitOk: make(chan struct{}),
reconn: make(chan struct{}),
exDeclared: make(map[string]struct{}),
}
for _, o := range options {
if err := o(r); err != nil {
re... | [
"func",
"New",
"(",
"dsn",
"string",
",",
"options",
"...",
"Option",
")",
"(",
"*",
"Rabbus",
",",
"error",
")",
"{",
"r",
":=",
"&",
"Rabbus",
"{",
"emit",
":",
"make",
"(",
"chan",
"Message",
")",
",",
"emitErr",
":",
"make",
"(",
"chan",
"err... | // New returns a new Rabbus configured with the
// variables from the config parameter, or returning an non-nil err
// if an error occurred while creating connection and channel. | [
"New",
"returns",
"a",
"new",
"Rabbus",
"configured",
"with",
"the",
"variables",
"from",
"the",
"config",
"parameter",
"or",
"returning",
"an",
"non",
"-",
"nil",
"err",
"if",
"an",
"error",
"occurred",
"while",
"creating",
"connection",
"and",
"channel",
"... | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L166-L201 |
125,349 | rafaeljesus/rabbus | rabbus.go | Run | func (r *Rabbus) Run(ctx context.Context) error {
notifyClose := r.NotifyClose(make(chan *amqp.Error))
for {
select {
case m, ok := <-r.emit:
if !ok {
return errors.New("unexpected close of emit channel")
}
r.produce(m)
case err := <-notifyClose:
if err == nil {
// "… on a graceful close,... | go | func (r *Rabbus) Run(ctx context.Context) error {
notifyClose := r.NotifyClose(make(chan *amqp.Error))
for {
select {
case m, ok := <-r.emit:
if !ok {
return errors.New("unexpected close of emit channel")
}
r.produce(m)
case err := <-notifyClose:
if err == nil {
// "… on a graceful close,... | [
"func",
"(",
"r",
"*",
"Rabbus",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"notifyClose",
":=",
"r",
".",
"NotifyClose",
"(",
"make",
"(",
"chan",
"*",
"amqp",
".",
"Error",
")",
")",
"\n\n",
"for",
"{",
"select",
"{",
... | // Run starts rabbus channels for emitting and listening for amqp connection close
// returns ctx error in case of any. | [
"Run",
"starts",
"rabbus",
"channels",
"for",
"emitting",
"and",
"listening",
"for",
"amqp",
"connection",
"close",
"returns",
"ctx",
"error",
"in",
"case",
"of",
"any",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L205-L232 |
125,350 | rafaeljesus/rabbus | rabbus.go | Listen | func (r *Rabbus) Listen(c ListenConfig) (chan ConsumerMessage, error) {
if err := c.validate(); err != nil {
return nil, err
}
msgs, err := r.CreateConsumer(c.Exchange, c.Key, c.Kind, c.Queue, r.config.durable)
if err != nil {
return nil, err
}
r.mu.Lock()
r.conDeclared++ // increase the declared consumers... | go | func (r *Rabbus) Listen(c ListenConfig) (chan ConsumerMessage, error) {
if err := c.validate(); err != nil {
return nil, err
}
msgs, err := r.CreateConsumer(c.Exchange, c.Key, c.Kind, c.Queue, r.config.durable)
if err != nil {
return nil, err
}
r.mu.Lock()
r.conDeclared++ // increase the declared consumers... | [
"func",
"(",
"r",
"*",
"Rabbus",
")",
"Listen",
"(",
"c",
"ListenConfig",
")",
"(",
"chan",
"ConsumerMessage",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"... | // Listen to a message from RabbitMQ, returns
// an error if exchange, queue name and function handler not passed or if an error occurred while creating
// amqp consumer. | [
"Listen",
"to",
"a",
"message",
"from",
"RabbitMQ",
"returns",
"an",
"error",
"if",
"exchange",
"queue",
"name",
"and",
"function",
"handler",
"not",
"passed",
"or",
"if",
"an",
"error",
"occurred",
"while",
"creating",
"amqp",
"consumer",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L246-L266 |
125,351 | rafaeljesus/rabbus | rabbus.go | Close | func (r *Rabbus) Close() error {
err := r.Amqp.Close()
close(r.emit)
close(r.emitOk)
close(r.emitErr)
close(r.reconn)
return err
} | go | func (r *Rabbus) Close() error {
err := r.Amqp.Close()
close(r.emit)
close(r.emitOk)
close(r.emitErr)
close(r.reconn)
return err
} | [
"func",
"(",
"r",
"*",
"Rabbus",
")",
"Close",
"(",
")",
"error",
"{",
"err",
":=",
"r",
".",
"Amqp",
".",
"Close",
"(",
")",
"\n",
"close",
"(",
"r",
".",
"emit",
")",
"\n",
"close",
"(",
"r",
".",
"emitOk",
")",
"\n",
"close",
"(",
"r",
"... | // Close channels and attempt to close channel and connection. | [
"Close",
"channels",
"and",
"attempt",
"to",
"close",
"channel",
"and",
"connection",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L269-L276 |
125,352 | rafaeljesus/rabbus | rabbus.go | Durable | func Durable(durable bool) Option {
return func(r *Rabbus) error {
r.config.durable = durable
return nil
}
} | go | func Durable(durable bool) Option {
return func(r *Rabbus) error {
r.config.durable = durable
return nil
}
} | [
"func",
"Durable",
"(",
"durable",
"bool",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"durable",
"=",
"durable",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // Durable indicates of the queue will survive broker restarts. Default to true. | [
"Durable",
"indicates",
"of",
"the",
"queue",
"will",
"survive",
"broker",
"restarts",
".",
"Default",
"to",
"true",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L321-L326 |
125,353 | rafaeljesus/rabbus | rabbus.go | PassiveExchange | func PassiveExchange(isExchangePassive bool) Option {
return func(r *Rabbus) error {
r.config.isExchangePassive = isExchangePassive
return nil
}
} | go | func PassiveExchange(isExchangePassive bool) Option {
return func(r *Rabbus) error {
r.config.isExchangePassive = isExchangePassive
return nil
}
} | [
"func",
"PassiveExchange",
"(",
"isExchangePassive",
"bool",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"isExchangePassive",
"=",
"isExchangePassive",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"... | // PassiveExchange forces passive connection with all exchanges using
// amqp's ExchangeDeclarePassive instead the default ExchangeDeclare | [
"PassiveExchange",
"forces",
"passive",
"connection",
"with",
"all",
"exchanges",
"using",
"amqp",
"s",
"ExchangeDeclarePassive",
"instead",
"the",
"default",
"ExchangeDeclare"
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L330-L335 |
125,354 | rafaeljesus/rabbus | rabbus.go | PrefetchCount | func PrefetchCount(count int) Option {
return func(r *Rabbus) error {
r.config.qos.prefetchCount = count
return nil
}
} | go | func PrefetchCount(count int) Option {
return func(r *Rabbus) error {
r.config.qos.prefetchCount = count
return nil
}
} | [
"func",
"PrefetchCount",
"(",
"count",
"int",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"qos",
".",
"prefetchCount",
"=",
"count",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // PrefetchCount limit the number of unacknowledged messages. | [
"PrefetchCount",
"limit",
"the",
"number",
"of",
"unacknowledged",
"messages",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L338-L343 |
125,355 | rafaeljesus/rabbus | rabbus.go | PrefetchSize | func PrefetchSize(size int) Option {
return func(r *Rabbus) error {
r.config.qos.prefetchSize = size
return nil
}
} | go | func PrefetchSize(size int) Option {
return func(r *Rabbus) error {
r.config.qos.prefetchSize = size
return nil
}
} | [
"func",
"PrefetchSize",
"(",
"size",
"int",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"qos",
".",
"prefetchSize",
"=",
"size",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // PrefetchSize when greater than zero, the server will try to keep at least
// that many bytes of deliveries flushed to the network before receiving
// acknowledgments from the consumers. | [
"PrefetchSize",
"when",
"greater",
"than",
"zero",
"the",
"server",
"will",
"try",
"to",
"keep",
"at",
"least",
"that",
"many",
"bytes",
"of",
"deliveries",
"flushed",
"to",
"the",
"network",
"before",
"receiving",
"acknowledgments",
"from",
"the",
"consumers",
... | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L348-L353 |
125,356 | rafaeljesus/rabbus | rabbus.go | QosGlobal | func QosGlobal(global bool) Option {
return func(r *Rabbus) error {
r.config.qos.global = global
return nil
}
} | go | func QosGlobal(global bool) Option {
return func(r *Rabbus) error {
r.config.qos.global = global
return nil
}
} | [
"func",
"QosGlobal",
"(",
"global",
"bool",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"qos",
".",
"global",
"=",
"global",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // QosGlobal when global is true, these Qos settings apply to all existing and future
// consumers on all channels on the same connection. When false, the Channel.Qos
// settings will apply to all existing and future consumers on this channel.
// RabbitMQ does not implement the global flag. | [
"QosGlobal",
"when",
"global",
"is",
"true",
"these",
"Qos",
"settings",
"apply",
"to",
"all",
"existing",
"and",
"future",
"consumers",
"on",
"all",
"channels",
"on",
"the",
"same",
"connection",
".",
"When",
"false",
"the",
"Channel",
".",
"Qos",
"settings... | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L359-L364 |
125,357 | rafaeljesus/rabbus | rabbus.go | Attempts | func Attempts(attempts int) Option {
return func(r *Rabbus) error {
r.config.retryCfg.attempts = attempts
return nil
}
} | go | func Attempts(attempts int) Option {
return func(r *Rabbus) error {
r.config.retryCfg.attempts = attempts
return nil
}
} | [
"func",
"Attempts",
"(",
"attempts",
"int",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"retryCfg",
".",
"attempts",
"=",
"attempts",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // Attempts is the max number of retries on broker outages. | [
"Attempts",
"is",
"the",
"max",
"number",
"of",
"retries",
"on",
"broker",
"outages",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L367-L372 |
125,358 | rafaeljesus/rabbus | rabbus.go | Sleep | func Sleep(sleep time.Duration) Option {
return func(r *Rabbus) error {
if sleep == 0 {
r.config.retryCfg.reconnectSleep = time.Second * 10
}
r.config.retryCfg.sleep = sleep
return nil
}
} | go | func Sleep(sleep time.Duration) Option {
return func(r *Rabbus) error {
if sleep == 0 {
r.config.retryCfg.reconnectSleep = time.Second * 10
}
r.config.retryCfg.sleep = sleep
return nil
}
} | [
"func",
"Sleep",
"(",
"sleep",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"if",
"sleep",
"==",
"0",
"{",
"r",
".",
"config",
".",
"retryCfg",
".",
"reconnectSleep",
"=",
"time",
".",
"... | // Sleep is the sleep time of the retry mechanism. | [
"Sleep",
"is",
"the",
"sleep",
"time",
"of",
"the",
"retry",
"mechanism",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L375-L383 |
125,359 | rafaeljesus/rabbus | rabbus.go | BreakerInterval | func BreakerInterval(interval time.Duration) Option {
return func(r *Rabbus) error {
r.config.breaker.interval = interval
return nil
}
} | go | func BreakerInterval(interval time.Duration) Option {
return func(r *Rabbus) error {
r.config.breaker.interval = interval
return nil
}
} | [
"func",
"BreakerInterval",
"(",
"interval",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"breaker",
".",
"interval",
"=",
"interval",
"\n",
"return",
"nil",
"\n",
"}... | // BreakerInterval is the cyclic period of the closed state for CircuitBreaker to clear the internal counts,
// If Interval is 0, CircuitBreaker doesn't clear the internal counts during the closed state. | [
"BreakerInterval",
"is",
"the",
"cyclic",
"period",
"of",
"the",
"closed",
"state",
"for",
"CircuitBreaker",
"to",
"clear",
"the",
"internal",
"counts",
"If",
"Interval",
"is",
"0",
"CircuitBreaker",
"doesn",
"t",
"clear",
"the",
"internal",
"counts",
"during",
... | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L387-L392 |
125,360 | rafaeljesus/rabbus | rabbus.go | BreakerTimeout | func BreakerTimeout(timeout time.Duration) Option {
return func(r *Rabbus) error {
r.config.breaker.timeout = timeout
return nil
}
} | go | func BreakerTimeout(timeout time.Duration) Option {
return func(r *Rabbus) error {
r.config.breaker.timeout = timeout
return nil
}
} | [
"func",
"BreakerTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"breaker",
".",
"timeout",
"=",
"timeout",
"\n",
"return",
"nil",
"\n",
"}",
... | // BreakerTimeout is the period of the open state, after which the state of CircuitBreaker becomes half-open.
// If Timeout is 0, the timeout value of CircuitBreaker is set to 60 seconds. | [
"BreakerTimeout",
"is",
"the",
"period",
"of",
"the",
"open",
"state",
"after",
"which",
"the",
"state",
"of",
"CircuitBreaker",
"becomes",
"half",
"-",
"open",
".",
"If",
"Timeout",
"is",
"0",
"the",
"timeout",
"value",
"of",
"CircuitBreaker",
"is",
"set",
... | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L396-L401 |
125,361 | rafaeljesus/rabbus | rabbus.go | Threshold | func Threshold(threshold uint32) Option {
return func(r *Rabbus) error {
if threshold == 0 {
threshold = 5
}
r.config.breaker.threshold = threshold
return nil
}
} | go | func Threshold(threshold uint32) Option {
return func(r *Rabbus) error {
if threshold == 0 {
threshold = 5
}
r.config.breaker.threshold = threshold
return nil
}
} | [
"func",
"Threshold",
"(",
"threshold",
"uint32",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"if",
"threshold",
"==",
"0",
"{",
"threshold",
"=",
"5",
"\n",
"}",
"\n",
"r",
".",
"config",
".",
"breaker",
".",
"... | // Threshold when a threshold of failures has been reached, future calls to the broker will not run.
// During this state, the circuit breaker will periodically allow the calls to run and, if it is successful,
// will start running the function again. Default value is 5. | [
"Threshold",
"when",
"a",
"threshold",
"of",
"failures",
"has",
"been",
"reached",
"future",
"calls",
"to",
"the",
"broker",
"will",
"not",
"run",
".",
"During",
"this",
"state",
"the",
"circuit",
"breaker",
"will",
"periodically",
"allow",
"the",
"calls",
"... | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L406-L414 |
125,362 | rafaeljesus/rabbus | rabbus.go | OnStateChange | func OnStateChange(fn OnStateChangeFunc) Option {
return func(r *Rabbus) error {
r.config.breaker.onStateChange = fn
return nil
}
} | go | func OnStateChange(fn OnStateChangeFunc) Option {
return func(r *Rabbus) error {
r.config.breaker.onStateChange = fn
return nil
}
} | [
"func",
"OnStateChange",
"(",
"fn",
"OnStateChangeFunc",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"r",
".",
"config",
".",
"breaker",
".",
"onStateChange",
"=",
"fn",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
... | // OnStateChange is called whenever the state of CircuitBreaker changes. | [
"OnStateChange",
"is",
"called",
"whenever",
"the",
"state",
"of",
"CircuitBreaker",
"changes",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L417-L422 |
125,363 | rafaeljesus/rabbus | rabbus.go | AmqpProvider | func AmqpProvider(provider Amqp) Option {
return func(r *Rabbus) error {
if provider != nil {
r.Amqp = provider
return nil
}
return errors.New("unexpected amqp provider")
}
} | go | func AmqpProvider(provider Amqp) Option {
return func(r *Rabbus) error {
if provider != nil {
r.Amqp = provider
return nil
}
return errors.New("unexpected amqp provider")
}
} | [
"func",
"AmqpProvider",
"(",
"provider",
"Amqp",
")",
"Option",
"{",
"return",
"func",
"(",
"r",
"*",
"Rabbus",
")",
"error",
"{",
"if",
"provider",
"!=",
"nil",
"{",
"r",
".",
"Amqp",
"=",
"provider",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return"... | // AmqpProvider expose a interface for interacting with amqp broker | [
"AmqpProvider",
"expose",
"a",
"interface",
"for",
"interacting",
"with",
"amqp",
"broker"
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/rabbus.go#L425-L433 |
125,364 | rafaeljesus/rabbus | consumer_message.go | Ack | func (cm ConsumerMessage) Ack(multiple bool) error {
return cm.delivery.Ack(multiple)
} | go | func (cm ConsumerMessage) Ack(multiple bool) error {
return cm.delivery.Ack(multiple)
} | [
"func",
"(",
"cm",
"ConsumerMessage",
")",
"Ack",
"(",
"multiple",
"bool",
")",
"error",
"{",
"return",
"cm",
".",
"delivery",
".",
"Ack",
"(",
"multiple",
")",
"\n",
"}"
] | // Ack delegates an acknowledgement through the Acknowledger interface that the client or server has finished work on a delivery.
// All deliveries in AMQP must be acknowledged. If you called Channel.Consume with autoAck true then the server will be automatically ack each message and this method should not be called. O... | [
"Ack",
"delegates",
"an",
"acknowledgement",
"through",
"the",
"Acknowledger",
"interface",
"that",
"the",
"client",
"or",
"server",
"has",
"finished",
"work",
"on",
"a",
"delivery",
".",
"All",
"deliveries",
"in",
"AMQP",
"must",
"be",
"acknowledged",
".",
"I... | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/consumer_message.go#L75-L77 |
125,365 | rafaeljesus/rabbus | consumer_message.go | Reject | func (cm ConsumerMessage) Reject(requeue bool) error {
return cm.delivery.Reject(requeue)
} | go | func (cm ConsumerMessage) Reject(requeue bool) error {
return cm.delivery.Reject(requeue)
} | [
"func",
"(",
"cm",
"ConsumerMessage",
")",
"Reject",
"(",
"requeue",
"bool",
")",
"error",
"{",
"return",
"cm",
".",
"delivery",
".",
"Reject",
"(",
"requeue",
")",
"\n",
"}"
] | // Reject delegates a negatively acknowledgement through the Acknowledger interface.
// When requeue is true, queue this message to be delivered to a consumer on a different channel. When requeue is false or the server is unable to queue this message, it will be dropped.
// If you are batch processing deliveries, and y... | [
"Reject",
"delegates",
"a",
"negatively",
"acknowledgement",
"through",
"the",
"Acknowledger",
"interface",
".",
"When",
"requeue",
"is",
"true",
"queue",
"this",
"message",
"to",
"be",
"delivered",
"to",
"a",
"consumer",
"on",
"a",
"different",
"channel",
".",
... | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/consumer_message.go#L92-L94 |
125,366 | rafaeljesus/rabbus | internal/amqp/amqp.go | New | func New(dsn string, pex bool) (*Amqp, error) {
conn, ch, err := createConnAndChan(dsn)
if err != nil {
return nil, err
}
return &Amqp{
conn: conn,
ch: ch,
passiveExchange: pex,
}, nil
} | go | func New(dsn string, pex bool) (*Amqp, error) {
conn, ch, err := createConnAndChan(dsn)
if err != nil {
return nil, err
}
return &Amqp{
conn: conn,
ch: ch,
passiveExchange: pex,
}, nil
} | [
"func",
"New",
"(",
"dsn",
"string",
",",
"pex",
"bool",
")",
"(",
"*",
"Amqp",
",",
"error",
")",
"{",
"conn",
",",
"ch",
",",
"err",
":=",
"createConnAndChan",
"(",
"dsn",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
... | // New returns a new Amqp configured, or returning an non-nil err
// if an error occurred while creating connection or channel. | [
"New",
"returns",
"a",
"new",
"Amqp",
"configured",
"or",
"returning",
"an",
"non",
"-",
"nil",
"err",
"if",
"an",
"error",
"occurred",
"while",
"creating",
"connection",
"or",
"channel",
"."
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/internal/amqp/amqp.go#L16-L27 |
125,367 | rafaeljesus/rabbus | internal/amqp/amqp.go | Publish | func (ai *Amqp) Publish(exchange, key string, opts amqp.Publishing) error {
return ai.ch.Publish(exchange, key, false, false, opts)
} | go | func (ai *Amqp) Publish(exchange, key string, opts amqp.Publishing) error {
return ai.ch.Publish(exchange, key, false, false, opts)
} | [
"func",
"(",
"ai",
"*",
"Amqp",
")",
"Publish",
"(",
"exchange",
",",
"key",
"string",
",",
"opts",
"amqp",
".",
"Publishing",
")",
"error",
"{",
"return",
"ai",
".",
"ch",
".",
"Publish",
"(",
"exchange",
",",
"key",
",",
"false",
",",
"false",
",... | // Publish wraps amqp.Publish method | [
"Publish",
"wraps",
"amqp",
".",
"Publish",
"method"
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/internal/amqp/amqp.go#L30-L32 |
125,368 | rafaeljesus/rabbus | internal/amqp/amqp.go | CreateConsumer | func (ai *Amqp) CreateConsumer(exchange, key, kind, queue string, durable bool) (<-chan amqp.Delivery, error) {
if err := ai.WithExchange(exchange, kind, durable); err != nil {
return nil, err
}
q, err := ai.ch.QueueDeclare(queue, durable, false, false, false, nil)
if err != nil {
return nil, err
}
if err :... | go | func (ai *Amqp) CreateConsumer(exchange, key, kind, queue string, durable bool) (<-chan amqp.Delivery, error) {
if err := ai.WithExchange(exchange, kind, durable); err != nil {
return nil, err
}
q, err := ai.ch.QueueDeclare(queue, durable, false, false, false, nil)
if err != nil {
return nil, err
}
if err :... | [
"func",
"(",
"ai",
"*",
"Amqp",
")",
"CreateConsumer",
"(",
"exchange",
",",
"key",
",",
"kind",
",",
"queue",
"string",
",",
"durable",
"bool",
")",
"(",
"<-",
"chan",
"amqp",
".",
"Delivery",
",",
"error",
")",
"{",
"if",
"err",
":=",
"ai",
".",
... | // CreateConsumer creates a amqp consumer | [
"CreateConsumer",
"creates",
"a",
"amqp",
"consumer"
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/internal/amqp/amqp.go#L35-L50 |
125,369 | rafaeljesus/rabbus | internal/amqp/amqp.go | WithExchange | func (ai *Amqp) WithExchange(exchange, kind string, durable bool) error {
if ai.passiveExchange {
return ai.ch.ExchangeDeclarePassive(exchange, kind, durable, false, false, false, nil)
}
return ai.ch.ExchangeDeclare(exchange, kind, durable, false, false, false, nil)
} | go | func (ai *Amqp) WithExchange(exchange, kind string, durable bool) error {
if ai.passiveExchange {
return ai.ch.ExchangeDeclarePassive(exchange, kind, durable, false, false, false, nil)
}
return ai.ch.ExchangeDeclare(exchange, kind, durable, false, false, false, nil)
} | [
"func",
"(",
"ai",
"*",
"Amqp",
")",
"WithExchange",
"(",
"exchange",
",",
"kind",
"string",
",",
"durable",
"bool",
")",
"error",
"{",
"if",
"ai",
".",
"passiveExchange",
"{",
"return",
"ai",
".",
"ch",
".",
"ExchangeDeclarePassive",
"(",
"exchange",
",... | // WithExchange creates a amqp exchange | [
"WithExchange",
"creates",
"a",
"amqp",
"exchange"
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/internal/amqp/amqp.go#L53-L59 |
125,370 | rafaeljesus/rabbus | internal/amqp/amqp.go | WithQos | func (ai *Amqp) WithQos(count, size int, global bool) error {
return ai.ch.Qos(count, size, global)
} | go | func (ai *Amqp) WithQos(count, size int, global bool) error {
return ai.ch.Qos(count, size, global)
} | [
"func",
"(",
"ai",
"*",
"Amqp",
")",
"WithQos",
"(",
"count",
",",
"size",
"int",
",",
"global",
"bool",
")",
"error",
"{",
"return",
"ai",
".",
"ch",
".",
"Qos",
"(",
"count",
",",
"size",
",",
"global",
")",
"\n",
"}"
] | // WithQos wrapper over amqp.Qos method | [
"WithQos",
"wrapper",
"over",
"amqp",
".",
"Qos",
"method"
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/internal/amqp/amqp.go#L62-L64 |
125,371 | rafaeljesus/rabbus | internal/amqp/amqp.go | NotifyClose | func (ai *Amqp) NotifyClose(c chan *amqp.Error) chan *amqp.Error {
return ai.conn.NotifyClose(c)
} | go | func (ai *Amqp) NotifyClose(c chan *amqp.Error) chan *amqp.Error {
return ai.conn.NotifyClose(c)
} | [
"func",
"(",
"ai",
"*",
"Amqp",
")",
"NotifyClose",
"(",
"c",
"chan",
"*",
"amqp",
".",
"Error",
")",
"chan",
"*",
"amqp",
".",
"Error",
"{",
"return",
"ai",
".",
"conn",
".",
"NotifyClose",
"(",
"c",
")",
"\n",
"}"
] | // NotifyClose wrapper over notifyClose method | [
"NotifyClose",
"wrapper",
"over",
"notifyClose",
"method"
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/internal/amqp/amqp.go#L67-L69 |
125,372 | rafaeljesus/rabbus | internal/amqp/amqp.go | Close | func (ai *Amqp) Close() error {
if err := ai.ch.Close(); err != nil {
return err
}
if ai.conn != nil {
return ai.conn.Close()
}
return nil
} | go | func (ai *Amqp) Close() error {
if err := ai.ch.Close(); err != nil {
return err
}
if ai.conn != nil {
return ai.conn.Close()
}
return nil
} | [
"func",
"(",
"ai",
"*",
"Amqp",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"ai",
".",
"ch",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"ai",
".",
"conn",
"!=",
"nil",
"{",
"... | // Close closes the running amqp connection and channel | [
"Close",
"closes",
"the",
"running",
"amqp",
"connection",
"and",
"channel"
] | 086d921c442ae5210224920df8517fb862ef56d4 | https://github.com/rafaeljesus/rabbus/blob/086d921c442ae5210224920df8517fb862ef56d4/internal/amqp/amqp.go#L72-L82 |
125,373 | a8m/djson | interface.go | Type | func Type(v interface{}) ValueType {
t := Unknown
switch v.(type) {
case nil:
t = Null
case bool:
t = Bool
case string:
t = String
case float64:
t = Number
case []interface{}:
t = Array
case map[string]interface{}:
t = Object
}
return t
} | go | func Type(v interface{}) ValueType {
t := Unknown
switch v.(type) {
case nil:
t = Null
case bool:
t = Bool
case string:
t = String
case float64:
t = Number
case []interface{}:
t = Array
case map[string]interface{}:
t = Object
}
return t
} | [
"func",
"Type",
"(",
"v",
"interface",
"{",
"}",
")",
"ValueType",
"{",
"t",
":=",
"Unknown",
"\n",
"switch",
"v",
".",
"(",
"type",
")",
"{",
"case",
"nil",
":",
"t",
"=",
"Null",
"\n",
"case",
"bool",
":",
"t",
"=",
"Bool",
"\n",
"case",
"str... | // Type returns the JSON-type of the given value | [
"Type",
"returns",
"the",
"JSON",
"-",
"type",
"of",
"the",
"given",
"value"
] | c02c5aef757f1282dbe880f399ca5e30dbf33c15 | https://github.com/a8m/djson/blob/c02c5aef757f1282dbe880f399ca5e30dbf33c15/interface.go#L46-L63 |
125,374 | a8m/djson | decode.go | NewDecoder | func NewDecoder(data []byte) *Decoder {
return &Decoder{
data: data,
end: len(data),
}
} | go | func NewDecoder(data []byte) *Decoder {
return &Decoder{
data: data,
end: len(data),
}
} | [
"func",
"NewDecoder",
"(",
"data",
"[",
"]",
"byte",
")",
"*",
"Decoder",
"{",
"return",
"&",
"Decoder",
"{",
"data",
":",
"data",
",",
"end",
":",
"len",
"(",
"data",
")",
",",
"}",
"\n",
"}"
] | // NewDecoder creates new Decoder from the JSON-encoded data | [
"NewDecoder",
"creates",
"new",
"Decoder",
"from",
"the",
"JSON",
"-",
"encoded",
"data"
] | c02c5aef757f1282dbe880f399ca5e30dbf33c15 | https://github.com/a8m/djson/blob/c02c5aef757f1282dbe880f399ca5e30dbf33c15/decode.go#L18-L23 |
125,375 | a8m/djson | decode.go | number | func (d *Decoder) number() (float64, error) {
var (
n float64
isFloat bool
c = d.data[d.pos]
start = d.pos
)
// digits first
switch {
case c == '0':
c = d.next()
case '1' <= c && c <= '9':
for ; c >= '0' && c <= '9'; c = d.next() {
n = 10*n + float64(c-'0')
}
}
// . followed by ... | go | func (d *Decoder) number() (float64, error) {
var (
n float64
isFloat bool
c = d.data[d.pos]
start = d.pos
)
// digits first
switch {
case c == '0':
c = d.next()
case '1' <= c && c <= '9':
for ; c >= '0' && c <= '9'; c = d.next() {
n = 10*n + float64(c-'0')
}
}
// . followed by ... | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"number",
"(",
")",
"(",
"float64",
",",
"error",
")",
"{",
"var",
"(",
"n",
"float64",
"\n",
"isFloat",
"bool",
"\n",
"c",
"=",
"d",
".",
"data",
"[",
"d",
".",
"pos",
"]",
"\n",
"start",
"=",
"d",
".",... | // number called by `any` after reading number between 0 to 9 | [
"number",
"called",
"by",
"any",
"after",
"reading",
"number",
"between",
"0",
"to",
"9"
] | c02c5aef757f1282dbe880f399ca5e30dbf33c15 | https://github.com/a8m/djson/blob/c02c5aef757f1282dbe880f399ca5e30dbf33c15/decode.go#L259-L318 |
125,376 | a8m/djson | decode.go | array | func (d *Decoder) array() ([]interface{}, error) {
// the '[' token already scanned
d.pos++
var (
c byte
v interface{}
err error
array = make([]interface{}, 0)
)
// look ahead for ] - if the array is empty.
if c = d.skipSpaces(); c == ']' {
d.pos++
goto out
}
scan:
if v, err = d.any(); ... | go | func (d *Decoder) array() ([]interface{}, error) {
// the '[' token already scanned
d.pos++
var (
c byte
v interface{}
err error
array = make([]interface{}, 0)
)
// look ahead for ] - if the array is empty.
if c = d.skipSpaces(); c == ']' {
d.pos++
goto out
}
scan:
if v, err = d.any(); ... | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"array",
"(",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// the '[' token already scanned",
"d",
".",
"pos",
"++",
"\n\n",
"var",
"(",
"c",
"byte",
"\n",
"v",
"interface",
"{",
"}",
"\... | // array accept valid JSON array value | [
"array",
"accept",
"valid",
"JSON",
"array",
"value"
] | c02c5aef757f1282dbe880f399ca5e30dbf33c15 | https://github.com/a8m/djson/blob/c02c5aef757f1282dbe880f399ca5e30dbf33c15/decode.go#L321-L357 |
125,377 | a8m/djson | decode.go | object | func (d *Decoder) object() (map[string]interface{}, error) {
// the '{' token already scanned
d.pos++
var (
c byte
k string
v interface{}
err error
obj = make(map[string]interface{})
)
// look ahead for } - if the object has no keys.
if c = d.skipSpaces(); c == '}' {
d.pos++
return obj, nil
... | go | func (d *Decoder) object() (map[string]interface{}, error) {
// the '{' token already scanned
d.pos++
var (
c byte
k string
v interface{}
err error
obj = make(map[string]interface{})
)
// look ahead for } - if the object has no keys.
if c = d.skipSpaces(); c == '}' {
d.pos++
return obj, nil
... | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"object",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// the '{' token already scanned",
"d",
".",
"pos",
"++",
"\n\n",
"var",
"(",
"c",
"byte",
"\n",
"k",
"string",... | // object accept valid JSON array value | [
"object",
"accept",
"valid",
"JSON",
"array",
"value"
] | c02c5aef757f1282dbe880f399ca5e30dbf33c15 | https://github.com/a8m/djson/blob/c02c5aef757f1282dbe880f399ca5e30dbf33c15/decode.go#L360-L416 |
125,378 | a8m/djson | decode.go | next | func (d *Decoder) next() byte {
d.pos++
if d.pos < d.end {
return d.data[d.pos]
}
return 0
} | go | func (d *Decoder) next() byte {
d.pos++
if d.pos < d.end {
return d.data[d.pos]
}
return 0
} | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"next",
"(",
")",
"byte",
"{",
"d",
".",
"pos",
"++",
"\n",
"if",
"d",
".",
"pos",
"<",
"d",
".",
"end",
"{",
"return",
"d",
".",
"data",
"[",
"d",
".",
"pos",
"]",
"\n",
"}",
"\n",
"return",
"0",
"\... | // next return the next byte in the input | [
"next",
"return",
"the",
"next",
"byte",
"in",
"the",
"input"
] | c02c5aef757f1282dbe880f399ca5e30dbf33c15 | https://github.com/a8m/djson/blob/c02c5aef757f1282dbe880f399ca5e30dbf33c15/decode.go#L419-L425 |
125,379 | a8m/djson | decode.go | skipSpaces | func (d *Decoder) skipSpaces() byte {
loop:
if d.pos == d.end {
return 0
}
switch c := d.data[d.pos]; c {
case ' ', '\t', '\n', '\r':
d.pos++
goto loop
default:
return c
}
} | go | func (d *Decoder) skipSpaces() byte {
loop:
if d.pos == d.end {
return 0
}
switch c := d.data[d.pos]; c {
case ' ', '\t', '\n', '\r':
d.pos++
goto loop
default:
return c
}
} | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"skipSpaces",
"(",
")",
"byte",
"{",
"loop",
":",
"if",
"d",
".",
"pos",
"==",
"d",
".",
"end",
"{",
"return",
"0",
"\n",
"}",
"\n",
"switch",
"c",
":=",
"d",
".",
"data",
"[",
"d",
".",
"pos",
"]",
";... | // returns the next char after white spaces | [
"returns",
"the",
"next",
"char",
"after",
"white",
"spaces"
] | c02c5aef757f1282dbe880f399ca5e30dbf33c15 | https://github.com/a8m/djson/blob/c02c5aef757f1282dbe880f399ca5e30dbf33c15/decode.go#L428-L440 |
125,380 | a8m/djson | decode.go | error | func (d *Decoder) error(c byte, context string) error {
if d.pos < d.end {
return &SyntaxError{"invalid character " + quoteChar(c) + " " + context, d.pos + 1}
}
return ErrUnexpectedEOF
} | go | func (d *Decoder) error(c byte, context string) error {
if d.pos < d.end {
return &SyntaxError{"invalid character " + quoteChar(c) + " " + context, d.pos + 1}
}
return ErrUnexpectedEOF
} | [
"func",
"(",
"d",
"*",
"Decoder",
")",
"error",
"(",
"c",
"byte",
",",
"context",
"string",
")",
"error",
"{",
"if",
"d",
".",
"pos",
"<",
"d",
".",
"end",
"{",
"return",
"&",
"SyntaxError",
"{",
"\"",
"\"",
"+",
"quoteChar",
"(",
"c",
")",
"+"... | // emit sytax errors | [
"emit",
"sytax",
"errors"
] | c02c5aef757f1282dbe880f399ca5e30dbf33c15 | https://github.com/a8m/djson/blob/c02c5aef757f1282dbe880f399ca5e30dbf33c15/decode.go#L443-L448 |
125,381 | wirepair/gcd | gcdapi/fetch.go | FailRequestWithParams | func (c *Fetch) FailRequestWithParams(v *FetchFailRequestParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Fetch.failRequest", Params: v})
} | go | func (c *Fetch) FailRequestWithParams(v *FetchFailRequestParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Fetch.failRequest", Params: v})
} | [
"func",
"(",
"c",
"*",
"Fetch",
")",
"FailRequestWithParams",
"(",
"v",
"*",
"FetchFailRequestParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
".",
"target",
","... | // FailRequestWithParams - Causes the request to fail with specified reason. | [
"FailRequestWithParams",
"-",
"Causes",
"the",
"request",
"to",
"fail",
"with",
"specified",
"reason",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/fetch.go#L110-L112 |
125,382 | wirepair/gcd | gcdapi/fetch.go | FulfillRequestWithParams | func (c *Fetch) FulfillRequestWithParams(v *FetchFulfillRequestParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Fetch.fulfillRequest", Params: v})
} | go | func (c *Fetch) FulfillRequestWithParams(v *FetchFulfillRequestParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Fetch.fulfillRequest", Params: v})
} | [
"func",
"(",
"c",
"*",
"Fetch",
")",
"FulfillRequestWithParams",
"(",
"v",
"*",
"FetchFulfillRequestParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
".",
"target",... | // FulfillRequestWithParams - Provides response to the request. | [
"FulfillRequestWithParams",
"-",
"Provides",
"response",
"to",
"the",
"request",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/fetch.go#L138-L140 |
125,383 | wirepair/gcd | gcdapi/fetch.go | FulfillRequest | func (c *Fetch) FulfillRequest(requestId string, responseCode int, responseHeaders []*FetchHeaderEntry, body string, responsePhrase string) (*gcdmessage.ChromeResponse, error) {
var v FetchFulfillRequestParams
v.RequestId = requestId
v.ResponseCode = responseCode
v.ResponseHeaders = responseHeaders
v.Body = body
... | go | func (c *Fetch) FulfillRequest(requestId string, responseCode int, responseHeaders []*FetchHeaderEntry, body string, responsePhrase string) (*gcdmessage.ChromeResponse, error) {
var v FetchFulfillRequestParams
v.RequestId = requestId
v.ResponseCode = responseCode
v.ResponseHeaders = responseHeaders
v.Body = body
... | [
"func",
"(",
"c",
"*",
"Fetch",
")",
"FulfillRequest",
"(",
"requestId",
"string",
",",
"responseCode",
"int",
",",
"responseHeaders",
"[",
"]",
"*",
"FetchHeaderEntry",
",",
"body",
"string",
",",
"responsePhrase",
"string",
")",
"(",
"*",
"gcdmessage",
"."... | // FulfillRequest - Provides response to the request.
// requestId - An id the client received in requestPaused event.
// responseCode - An HTTP response code.
// responseHeaders - Response headers.
// body - A response body.
// responsePhrase - A textual representation of responseCode. If absent, a standard phrase mat... | [
"FulfillRequest",
"-",
"Provides",
"response",
"to",
"the",
"request",
".",
"requestId",
"-",
"An",
"id",
"the",
"client",
"received",
"in",
"requestPaused",
"event",
".",
"responseCode",
"-",
"An",
"HTTP",
"response",
"code",
".",
"responseHeaders",
"-",
"Res... | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/fetch.go#L148-L156 |
125,384 | wirepair/gcd | gcdapi/fetch.go | ContinueRequestWithParams | func (c *Fetch) ContinueRequestWithParams(v *FetchContinueRequestParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Fetch.continueRequest", Params: v})
} | go | func (c *Fetch) ContinueRequestWithParams(v *FetchContinueRequestParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Fetch.continueRequest", Params: v})
} | [
"func",
"(",
"c",
"*",
"Fetch",
")",
"ContinueRequestWithParams",
"(",
"v",
"*",
"FetchContinueRequestParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
".",
"target... | // ContinueRequestWithParams - Continues the request, optionally modifying some of its parameters. | [
"ContinueRequestWithParams",
"-",
"Continues",
"the",
"request",
"optionally",
"modifying",
"some",
"of",
"its",
"parameters",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/fetch.go#L172-L174 |
125,385 | wirepair/gcd | gcdapi/fetch.go | ContinueRequest | func (c *Fetch) ContinueRequest(requestId string, url string, method string, postData string, headers []*FetchHeaderEntry) (*gcdmessage.ChromeResponse, error) {
var v FetchContinueRequestParams
v.RequestId = requestId
v.Url = url
v.Method = method
v.PostData = postData
v.Headers = headers
return c.ContinueReques... | go | func (c *Fetch) ContinueRequest(requestId string, url string, method string, postData string, headers []*FetchHeaderEntry) (*gcdmessage.ChromeResponse, error) {
var v FetchContinueRequestParams
v.RequestId = requestId
v.Url = url
v.Method = method
v.PostData = postData
v.Headers = headers
return c.ContinueReques... | [
"func",
"(",
"c",
"*",
"Fetch",
")",
"ContinueRequest",
"(",
"requestId",
"string",
",",
"url",
"string",
",",
"method",
"string",
",",
"postData",
"string",
",",
"headers",
"[",
"]",
"*",
"FetchHeaderEntry",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeRespon... | // ContinueRequest - Continues the request, optionally modifying some of its parameters.
// requestId - An id the client received in requestPaused event.
// url - If set, the request url will be modified in a way that's not observable by page.
// method - If set, the request method is overridden.
// postData - If set, ... | [
"ContinueRequest",
"-",
"Continues",
"the",
"request",
"optionally",
"modifying",
"some",
"of",
"its",
"parameters",
".",
"requestId",
"-",
"An",
"id",
"the",
"client",
"received",
"in",
"requestPaused",
"event",
".",
"url",
"-",
"If",
"set",
"the",
"request",... | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/fetch.go#L182-L190 |
125,386 | wirepair/gcd | gcdapi/fetch.go | ContinueWithAuthWithParams | func (c *Fetch) ContinueWithAuthWithParams(v *FetchContinueWithAuthParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Fetch.continueWithAuth", Params: v})
} | go | func (c *Fetch) ContinueWithAuthWithParams(v *FetchContinueWithAuthParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Fetch.continueWithAuth", Params: v})
} | [
"func",
"(",
"c",
"*",
"Fetch",
")",
"ContinueWithAuthWithParams",
"(",
"v",
"*",
"FetchContinueWithAuthParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
".",
"targ... | // ContinueWithAuthWithParams - Continues a request supplying authChallengeResponse following authRequired event. | [
"ContinueWithAuthWithParams",
"-",
"Continues",
"a",
"request",
"supplying",
"authChallengeResponse",
"following",
"authRequired",
"event",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/fetch.go#L200-L202 |
125,387 | wirepair/gcd | gcdapi/fetch.go | ContinueWithAuth | func (c *Fetch) ContinueWithAuth(requestId string, authChallengeResponse *FetchAuthChallengeResponse) (*gcdmessage.ChromeResponse, error) {
var v FetchContinueWithAuthParams
v.RequestId = requestId
v.AuthChallengeResponse = authChallengeResponse
return c.ContinueWithAuthWithParams(&v)
} | go | func (c *Fetch) ContinueWithAuth(requestId string, authChallengeResponse *FetchAuthChallengeResponse) (*gcdmessage.ChromeResponse, error) {
var v FetchContinueWithAuthParams
v.RequestId = requestId
v.AuthChallengeResponse = authChallengeResponse
return c.ContinueWithAuthWithParams(&v)
} | [
"func",
"(",
"c",
"*",
"Fetch",
")",
"ContinueWithAuth",
"(",
"requestId",
"string",
",",
"authChallengeResponse",
"*",
"FetchAuthChallengeResponse",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"var",
"v",
"FetchContinueWithAuthPara... | // ContinueWithAuth - Continues a request supplying authChallengeResponse following authRequired event.
// requestId - An id the client received in authRequired event.
// authChallengeResponse - Response to with an authChallenge. | [
"ContinueWithAuth",
"-",
"Continues",
"a",
"request",
"supplying",
"authChallengeResponse",
"following",
"authRequired",
"event",
".",
"requestId",
"-",
"An",
"id",
"the",
"client",
"received",
"in",
"authRequired",
"event",
".",
"authChallengeResponse",
"-",
"Respons... | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/fetch.go#L207-L212 |
125,388 | wirepair/gcd | gcdapi/fetch.go | GetResponseBody | func (c *Fetch) GetResponseBody(requestId string) (string, bool, error) {
var v FetchGetResponseBodyParams
v.RequestId = requestId
return c.GetResponseBodyWithParams(&v)
} | go | func (c *Fetch) GetResponseBody(requestId string) (string, bool, error) {
var v FetchGetResponseBodyParams
v.RequestId = requestId
return c.GetResponseBodyWithParams(&v)
} | [
"func",
"(",
"c",
"*",
"Fetch",
")",
"GetResponseBody",
"(",
"requestId",
"string",
")",
"(",
"string",
",",
"bool",
",",
"error",
")",
"{",
"var",
"v",
"FetchGetResponseBodyParams",
"\n",
"v",
".",
"RequestId",
"=",
"requestId",
"\n",
"return",
"c",
"."... | // GetResponseBody - Causes the body of the response to be received from the server and returned as a single string. May only be issued for a request that is paused in the Response stage and is mutually exclusive with takeResponseBodyForInterceptionAsStream. Calling other methods that affect the request or disabling fe... | [
"GetResponseBody",
"-",
"Causes",
"the",
"body",
"of",
"the",
"response",
"to",
"be",
"received",
"from",
"the",
"server",
"and",
"returned",
"as",
"a",
"single",
"string",
".",
"May",
"only",
"be",
"issued",
"for",
"a",
"request",
"that",
"is",
"paused",
... | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/fetch.go#L255-L259 |
125,389 | wirepair/gcd | gcdapi/database.go | ExecuteSQLWithParams | func (c *Database) ExecuteSQLWithParams(v *DatabaseExecuteSQLParams) ([]string, []interface{}, *DatabaseError, error) {
resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Database.executeSQL", Params: v})
if err != nil {
return nil, nil, ... | go | func (c *Database) ExecuteSQLWithParams(v *DatabaseExecuteSQLParams) ([]string, []interface{}, *DatabaseError, error) {
resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Database.executeSQL", Params: v})
if err != nil {
return nil, nil, ... | [
"func",
"(",
"c",
"*",
"Database",
")",
"ExecuteSQLWithParams",
"(",
"v",
"*",
"DatabaseExecuteSQLParams",
")",
"(",
"[",
"]",
"string",
",",
"[",
"]",
"interface",
"{",
"}",
",",
"*",
"DatabaseError",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
... | // ExecuteSQLWithParams -
// Returns - columnNames - values - sqlError - | [
"ExecuteSQLWithParams",
"-",
"Returns",
"-",
"columnNames",
"-",
"values",
"-",
"sqlError",
"-"
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/database.go#L62-L92 |
125,390 | wirepair/gcd | gcdapi/database.go | ExecuteSQL | func (c *Database) ExecuteSQL(databaseId string, query string) ([]string, []interface{}, *DatabaseError, error) {
var v DatabaseExecuteSQLParams
v.DatabaseId = databaseId
v.Query = query
return c.ExecuteSQLWithParams(&v)
} | go | func (c *Database) ExecuteSQL(databaseId string, query string) ([]string, []interface{}, *DatabaseError, error) {
var v DatabaseExecuteSQLParams
v.DatabaseId = databaseId
v.Query = query
return c.ExecuteSQLWithParams(&v)
} | [
"func",
"(",
"c",
"*",
"Database",
")",
"ExecuteSQL",
"(",
"databaseId",
"string",
",",
"query",
"string",
")",
"(",
"[",
"]",
"string",
",",
"[",
"]",
"interface",
"{",
"}",
",",
"*",
"DatabaseError",
",",
"error",
")",
"{",
"var",
"v",
"DatabaseExe... | // ExecuteSQL -
// databaseId -
// query -
// Returns - columnNames - values - sqlError - | [
"ExecuteSQL",
"-",
"databaseId",
"-",
"query",
"-",
"Returns",
"-",
"columnNames",
"-",
"values",
"-",
"sqlError",
"-"
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/database.go#L98-L103 |
125,391 | wirepair/gcd | gcdapi/database.go | GetDatabaseTableNames | func (c *Database) GetDatabaseTableNames(databaseId string) ([]string, error) {
var v DatabaseGetDatabaseTableNamesParams
v.DatabaseId = databaseId
return c.GetDatabaseTableNamesWithParams(&v)
} | go | func (c *Database) GetDatabaseTableNames(databaseId string) ([]string, error) {
var v DatabaseGetDatabaseTableNamesParams
v.DatabaseId = databaseId
return c.GetDatabaseTableNamesWithParams(&v)
} | [
"func",
"(",
"c",
"*",
"Database",
")",
"GetDatabaseTableNames",
"(",
"databaseId",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"v",
"DatabaseGetDatabaseTableNamesParams",
"\n",
"v",
".",
"DatabaseId",
"=",
"databaseId",
"\n",
"ret... | // GetDatabaseTableNames -
// databaseId -
// Returns - tableNames - | [
"GetDatabaseTableNames",
"-",
"databaseId",
"-",
"Returns",
"-",
"tableNames",
"-"
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/database.go#L145-L149 |
125,392 | wirepair/gcd | gcdapi/input.go | DispatchKeyEventWithParams | func (c *Input) DispatchKeyEventWithParams(v *InputDispatchKeyEventParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.dispatchKeyEvent", Params: v})
} | go | func (c *Input) DispatchKeyEventWithParams(v *InputDispatchKeyEventParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.dispatchKeyEvent", Params: v})
} | [
"func",
"(",
"c",
"*",
"Input",
")",
"DispatchKeyEventWithParams",
"(",
"v",
"*",
"InputDispatchKeyEventParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
".",
"targ... | // DispatchKeyEventWithParams - Dispatches a key event to the page. | [
"DispatchKeyEventWithParams",
"-",
"Dispatches",
"a",
"key",
"event",
"to",
"the",
"page",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/input.go#L63-L65 |
125,393 | wirepair/gcd | gcdapi/input.go | InsertTextWithParams | func (c *Input) InsertTextWithParams(v *InputInsertTextParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.insertText", Params: v})
} | go | func (c *Input) InsertTextWithParams(v *InputInsertTextParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.insertText", Params: v})
} | [
"func",
"(",
"c",
"*",
"Input",
")",
"InsertTextWithParams",
"(",
"v",
"*",
"InputInsertTextParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
".",
"target",
",",
... | // InsertTextWithParams - This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME. | [
"InsertTextWithParams",
"-",
"This",
"method",
"emulates",
"inserting",
"text",
"that",
"doesn",
"t",
"come",
"from",
"a",
"key",
"press",
"for",
"example",
"an",
"emoji",
"keyboard",
"or",
"an",
"IME",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/input.go#L107-L109 |
125,394 | wirepair/gcd | gcdapi/input.go | InsertText | func (c *Input) InsertText(text string) (*gcdmessage.ChromeResponse, error) {
var v InputInsertTextParams
v.Text = text
return c.InsertTextWithParams(&v)
} | go | func (c *Input) InsertText(text string) (*gcdmessage.ChromeResponse, error) {
var v InputInsertTextParams
v.Text = text
return c.InsertTextWithParams(&v)
} | [
"func",
"(",
"c",
"*",
"Input",
")",
"InsertText",
"(",
"text",
"string",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"var",
"v",
"InputInsertTextParams",
"\n",
"v",
".",
"Text",
"=",
"text",
"\n",
"return",
"c",
".",
... | // InsertText - This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME.
// text - The text to insert. | [
"InsertText",
"-",
"This",
"method",
"emulates",
"inserting",
"text",
"that",
"doesn",
"t",
"come",
"from",
"a",
"key",
"press",
"for",
"example",
"an",
"emoji",
"keyboard",
"or",
"an",
"IME",
".",
"text",
"-",
"The",
"text",
"to",
"insert",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/input.go#L113-L117 |
125,395 | wirepair/gcd | gcdapi/input.go | DispatchMouseEventWithParams | func (c *Input) DispatchMouseEventWithParams(v *InputDispatchMouseEventParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.dispatchMouseEvent", Params: v})
} | go | func (c *Input) DispatchMouseEventWithParams(v *InputDispatchMouseEventParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.dispatchMouseEvent", Params: v})
} | [
"func",
"(",
"c",
"*",
"Input",
")",
"DispatchMouseEventWithParams",
"(",
"v",
"*",
"InputDispatchMouseEventParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
".",
"... | // DispatchMouseEventWithParams - Dispatches a mouse event to the page. | [
"DispatchMouseEventWithParams",
"-",
"Dispatches",
"a",
"mouse",
"event",
"to",
"the",
"page",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/input.go#L145-L147 |
125,396 | wirepair/gcd | gcdapi/input.go | DispatchTouchEventWithParams | func (c *Input) DispatchTouchEventWithParams(v *InputDispatchTouchEventParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.dispatchTouchEvent", Params: v})
} | go | func (c *Input) DispatchTouchEventWithParams(v *InputDispatchTouchEventParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.dispatchTouchEvent", Params: v})
} | [
"func",
"(",
"c",
"*",
"Input",
")",
"DispatchTouchEventWithParams",
"(",
"v",
"*",
"InputDispatchTouchEventParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
".",
"... | // DispatchTouchEventWithParams - Dispatches a touch event to the page. | [
"DispatchTouchEventWithParams",
"-",
"Dispatches",
"a",
"touch",
"event",
"to",
"the",
"page",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/input.go#L189-L191 |
125,397 | wirepair/gcd | gcdapi/input.go | EmulateTouchFromMouseEventWithParams | func (c *Input) EmulateTouchFromMouseEventWithParams(v *InputEmulateTouchFromMouseEventParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.emulateTouchFromMouseEvent", Params: v})
} | go | func (c *Input) EmulateTouchFromMouseEventWithParams(v *InputEmulateTouchFromMouseEventParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.emulateTouchFromMouseEvent", Params: v})
} | [
"func",
"(",
"c",
"*",
"Input",
")",
"EmulateTouchFromMouseEventWithParams",
"(",
"v",
"*",
"InputEmulateTouchFromMouseEventParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
... | // EmulateTouchFromMouseEventWithParams - Emulates touch event from the mouse event parameters. | [
"EmulateTouchFromMouseEventWithParams",
"-",
"Emulates",
"touch",
"event",
"from",
"the",
"mouse",
"event",
"parameters",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/input.go#L229-L231 |
125,398 | wirepair/gcd | gcdapi/input.go | SynthesizePinchGestureWithParams | func (c *Input) SynthesizePinchGestureWithParams(v *InputSynthesizePinchGestureParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.synthesizePinchGesture", Params: v})
} | go | func (c *Input) SynthesizePinchGestureWithParams(v *InputSynthesizePinchGestureParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.synthesizePinchGesture", Params: v})
} | [
"func",
"(",
"c",
"*",
"Input",
")",
"SynthesizePinchGestureWithParams",
"(",
"v",
"*",
"InputSynthesizePinchGestureParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
... | // SynthesizePinchGestureWithParams - Synthesizes a pinch gesture over a time period by issuing appropriate touch events. | [
"SynthesizePinchGestureWithParams",
"-",
"Synthesizes",
"a",
"pinch",
"gesture",
"over",
"a",
"time",
"period",
"by",
"issuing",
"appropriate",
"touch",
"events",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/input.go#L289-L291 |
125,399 | wirepair/gcd | gcdapi/input.go | SynthesizeScrollGestureWithParams | func (c *Input) SynthesizeScrollGestureWithParams(v *InputSynthesizeScrollGestureParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.synthesizeScrollGesture", Params: v})
} | go | func (c *Input) SynthesizeScrollGestureWithParams(v *InputSynthesizeScrollGestureParams) (*gcdmessage.ChromeResponse, error) {
return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Input.synthesizeScrollGesture", Params: v})
} | [
"func",
"(",
"c",
"*",
"Input",
")",
"SynthesizeScrollGestureWithParams",
"(",
"v",
"*",
"InputSynthesizeScrollGestureParams",
")",
"(",
"*",
"gcdmessage",
".",
"ChromeResponse",
",",
"error",
")",
"{",
"return",
"gcdmessage",
".",
"SendDefaultRequest",
"(",
"c",
... | // SynthesizeScrollGestureWithParams - Synthesizes a scroll gesture over a time period by issuing appropriate touch events. | [
"SynthesizeScrollGestureWithParams",
"-",
"Synthesizes",
"a",
"scroll",
"gesture",
"over",
"a",
"time",
"period",
"by",
"issuing",
"appropriate",
"touch",
"events",
"."
] | 2f7807e117ff2d25c3c702d6eef0155ba9d1a556 | https://github.com/wirepair/gcd/blob/2f7807e117ff2d25c3c702d6eef0155ba9d1a556/gcdapi/input.go#L337-L339 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.