repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
henrylee2cn/pholcus | common/mahonia/convert_string.go | ConvertString | func (d Decoder) ConvertString(s string) string {
bytes := []byte(s)
runes := make([]rune, len(s))
destPos := 0
for len(bytes) > 0 {
c, size, status := d(bytes)
if status == STATE_ONLY {
bytes = bytes[size:]
continue
}
if status == NO_ROOM {
c = 0xfffd
size = len(bytes)
status = INVALID_CH... | go | func (d Decoder) ConvertString(s string) string {
bytes := []byte(s)
runes := make([]rune, len(s))
destPos := 0
for len(bytes) > 0 {
c, size, status := d(bytes)
if status == STATE_ONLY {
bytes = bytes[size:]
continue
}
if status == NO_ROOM {
c = 0xfffd
size = len(bytes)
status = INVALID_CH... | [
"func",
"(",
"d",
"Decoder",
")",
"ConvertString",
"(",
"s",
"string",
")",
"string",
"{",
"bytes",
":=",
"[",
"]",
"byte",
"(",
"s",
")",
"\n",
"runes",
":=",
"make",
"(",
"[",
"]",
"rune",
",",
"len",
"(",
"s",
")",
")",
"\n",
"destPos",
":="... | // ConvertString converts a string from d's encoding to UTF-8. | [
"ConvertString",
"converts",
"a",
"string",
"from",
"d",
"s",
"encoding",
"to",
"UTF",
"-",
"8",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/convert_string.go#L35-L60 | train |
henrylee2cn/pholcus | common/mahonia/convert_string.go | ConvertStringOK | func (e Encoder) ConvertStringOK(s string) (result string, ok bool) {
dest := make([]byte, len(s)+10)
destPos := 0
ok = true
for i, r := range s {
// The following test is copied from utf8.ValidString.
if r == utf8.RuneError && ok {
_, size := utf8.DecodeRuneInString(s[i:])
if size == 1 {
ok = false
... | go | func (e Encoder) ConvertStringOK(s string) (result string, ok bool) {
dest := make([]byte, len(s)+10)
destPos := 0
ok = true
for i, r := range s {
// The following test is copied from utf8.ValidString.
if r == utf8.RuneError && ok {
_, size := utf8.DecodeRuneInString(s[i:])
if size == 1 {
ok = false
... | [
"func",
"(",
"e",
"Encoder",
")",
"ConvertStringOK",
"(",
"s",
"string",
")",
"(",
"result",
"string",
",",
"ok",
"bool",
")",
"{",
"dest",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"s",
")",
"+",
"10",
")",
"\n",
"destPos",
":=",
"... | // ConvertStringOK converts a string from UTF-8 to e's encoding. It also
// returns a boolean indicating whether every character was converted
// successfully. | [
"ConvertStringOK",
"converts",
"a",
"string",
"from",
"UTF",
"-",
"8",
"to",
"e",
"s",
"encoding",
".",
"It",
"also",
"returns",
"a",
"boolean",
"indicating",
"whether",
"every",
"character",
"was",
"converted",
"successfully",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/convert_string.go#L65-L101 | train |
henrylee2cn/pholcus | common/mahonia/convert_string.go | ConvertStringOK | func (d Decoder) ConvertStringOK(s string) (result string, ok bool) {
bytes := []byte(s)
runes := make([]rune, len(s))
destPos := 0
ok = true
for len(bytes) > 0 {
c, size, status := d(bytes)
switch status {
case STATE_ONLY:
bytes = bytes[size:]
continue
case NO_ROOM:
c = 0xfffd
size = len(by... | go | func (d Decoder) ConvertStringOK(s string) (result string, ok bool) {
bytes := []byte(s)
runes := make([]rune, len(s))
destPos := 0
ok = true
for len(bytes) > 0 {
c, size, status := d(bytes)
switch status {
case STATE_ONLY:
bytes = bytes[size:]
continue
case NO_ROOM:
c = 0xfffd
size = len(by... | [
"func",
"(",
"d",
"Decoder",
")",
"ConvertStringOK",
"(",
"s",
"string",
")",
"(",
"result",
"string",
",",
"ok",
"bool",
")",
"{",
"bytes",
":=",
"[",
"]",
"byte",
"(",
"s",
")",
"\n",
"runes",
":=",
"make",
"(",
"[",
"]",
"rune",
",",
"len",
... | // ConvertStringOK converts a string from d's encoding to UTF-8.
// It also returns a boolean indicating whether every character was converted
// successfully. | [
"ConvertStringOK",
"converts",
"a",
"string",
"from",
"d",
"s",
"encoding",
"to",
"UTF",
"-",
"8",
".",
"It",
"also",
"returns",
"a",
"boolean",
"indicating",
"whether",
"every",
"character",
"was",
"converted",
"successfully",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/convert_string.go#L106-L135 | train |
henrylee2cn/pholcus | common/goquery/query.go | IsMatcher | func (s *Selection) IsMatcher(m Matcher) bool {
if len(s.Nodes) > 0 {
if len(s.Nodes) == 1 {
return m.Match(s.Nodes[0])
}
return len(m.Filter(s.Nodes)) > 0
}
return false
} | go | func (s *Selection) IsMatcher(m Matcher) bool {
if len(s.Nodes) > 0 {
if len(s.Nodes) == 1 {
return m.Match(s.Nodes[0])
}
return len(m.Filter(s.Nodes)) > 0
}
return false
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"IsMatcher",
"(",
"m",
"Matcher",
")",
"bool",
"{",
"if",
"len",
"(",
"s",
".",
"Nodes",
")",
">",
"0",
"{",
"if",
"len",
"(",
"s",
".",
"Nodes",
")",
"==",
"1",
"{",
"return",
"m",
".",
"Match",
"(",
... | // IsMatcher checks the current matched set of elements against a matcher and
// returns true if at least one of these elements matches. | [
"IsMatcher",
"checks",
"the",
"current",
"matched",
"set",
"of",
"elements",
"against",
"a",
"matcher",
"and",
"returns",
"true",
"if",
"at",
"least",
"one",
"of",
"these",
"elements",
"matches",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/query.go#L17-L26 | train |
henrylee2cn/pholcus | common/goquery/query.go | IsFunction | func (s *Selection) IsFunction(f func(int, *Selection) bool) bool {
return s.FilterFunction(f).Length() > 0
} | go | func (s *Selection) IsFunction(f func(int, *Selection) bool) bool {
return s.FilterFunction(f).Length() > 0
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"IsFunction",
"(",
"f",
"func",
"(",
"int",
",",
"*",
"Selection",
")",
"bool",
")",
"bool",
"{",
"return",
"s",
".",
"FilterFunction",
"(",
"f",
")",
".",
"Length",
"(",
")",
">",
"0",
"\n",
"}"
] | // IsFunction checks the current matched set of elements against a predicate and
// returns true if at least one of these elements matches. | [
"IsFunction",
"checks",
"the",
"current",
"matched",
"set",
"of",
"elements",
"against",
"a",
"predicate",
"and",
"returns",
"true",
"if",
"at",
"least",
"one",
"of",
"these",
"elements",
"matches",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/query.go#L30-L32 | train |
henrylee2cn/pholcus | common/goquery/query.go | IsSelection | func (s *Selection) IsSelection(sel *Selection) bool {
return s.FilterSelection(sel).Length() > 0
} | go | func (s *Selection) IsSelection(sel *Selection) bool {
return s.FilterSelection(sel).Length() > 0
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"IsSelection",
"(",
"sel",
"*",
"Selection",
")",
"bool",
"{",
"return",
"s",
".",
"FilterSelection",
"(",
"sel",
")",
".",
"Length",
"(",
")",
">",
"0",
"\n",
"}"
] | // IsSelection checks the current matched set of elements against a Selection object
// and returns true if at least one of these elements matches. | [
"IsSelection",
"checks",
"the",
"current",
"matched",
"set",
"of",
"elements",
"against",
"a",
"Selection",
"object",
"and",
"returns",
"true",
"if",
"at",
"least",
"one",
"of",
"these",
"elements",
"matches",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/query.go#L36-L38 | train |
henrylee2cn/pholcus | common/goquery/query.go | IsNodes | func (s *Selection) IsNodes(nodes ...*html.Node) bool {
return s.FilterNodes(nodes...).Length() > 0
} | go | func (s *Selection) IsNodes(nodes ...*html.Node) bool {
return s.FilterNodes(nodes...).Length() > 0
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"IsNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"bool",
"{",
"return",
"s",
".",
"FilterNodes",
"(",
"nodes",
"...",
")",
".",
"Length",
"(",
")",
">",
"0",
"\n",
"}"
] | // IsNodes checks the current matched set of elements against the specified nodes
// and returns true if at least one of these elements matches. | [
"IsNodes",
"checks",
"the",
"current",
"matched",
"set",
"of",
"elements",
"against",
"the",
"specified",
"nodes",
"and",
"returns",
"true",
"if",
"at",
"least",
"one",
"of",
"these",
"elements",
"matches",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/query.go#L42-L44 | train |
henrylee2cn/pholcus | common/goquery/query.go | Contains | func (s *Selection) Contains(n *html.Node) bool {
return sliceContains(s.Nodes, n)
} | go | func (s *Selection) Contains(n *html.Node) bool {
return sliceContains(s.Nodes, n)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Contains",
"(",
"n",
"*",
"html",
".",
"Node",
")",
"bool",
"{",
"return",
"sliceContains",
"(",
"s",
".",
"Nodes",
",",
"n",
")",
"\n",
"}"
] | // Contains returns true if the specified Node is within,
// at any depth, one of the nodes in the Selection object.
// It is NOT inclusive, to behave like jQuery's implementation, and
// unlike Javascript's .contains, so if the contained
// node is itself in the selection, it returns false. | [
"Contains",
"returns",
"true",
"if",
"the",
"specified",
"Node",
"is",
"within",
"at",
"any",
"depth",
"one",
"of",
"the",
"nodes",
"in",
"the",
"Selection",
"object",
".",
"It",
"is",
"NOT",
"inclusive",
"to",
"behave",
"like",
"jQuery",
"s",
"implementat... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/query.go#L51-L53 | train |
henrylee2cn/pholcus | logs/logs/log.go | NewLogger | func NewLogger(channellen int64, stealLevel ...int) *BeeLogger {
bl := new(BeeLogger)
bl.level = LevelDebug
bl.loggerFuncCallDepth = 2
bl.msg = make(chan *logMsg, channellen)
bl.outputs = make(map[string]LoggerInterface)
bl.status = WORK
bl.steal = make(chan *logMsg, channellen)
if len(stealLevel) > 0 {
bl.st... | go | func NewLogger(channellen int64, stealLevel ...int) *BeeLogger {
bl := new(BeeLogger)
bl.level = LevelDebug
bl.loggerFuncCallDepth = 2
bl.msg = make(chan *logMsg, channellen)
bl.outputs = make(map[string]LoggerInterface)
bl.status = WORK
bl.steal = make(chan *logMsg, channellen)
if len(stealLevel) > 0 {
bl.st... | [
"func",
"NewLogger",
"(",
"channellen",
"int64",
",",
"stealLevel",
"...",
"int",
")",
"*",
"BeeLogger",
"{",
"bl",
":=",
"new",
"(",
"BeeLogger",
")",
"\n",
"bl",
".",
"level",
"=",
"LevelDebug",
"\n",
"bl",
".",
"loggerFuncCallDepth",
"=",
"2",
"\n",
... | // NewLogger returns a new BeeLogger.
// channellen means the number of messages in chan.
// if the buffering chan is full, logger adapters write to file or other way. | [
"NewLogger",
"returns",
"a",
"new",
"BeeLogger",
".",
"channellen",
"means",
"the",
"number",
"of",
"messages",
"in",
"chan",
".",
"if",
"the",
"buffering",
"chan",
"is",
"full",
"logger",
"adapters",
"write",
"to",
"file",
"or",
"other",
"way",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L120-L134 | train |
henrylee2cn/pholcus | logs/logs/log.go | SetLogger | func (bl *BeeLogger) SetLogger(adaptername string, config map[string]interface{}) error {
bl.lock.Lock()
defer bl.lock.Unlock()
if log, ok := adapters[adaptername]; ok {
lg := log()
err := lg.Init(config)
bl.outputs[adaptername] = lg
if err != nil {
fmt.Println("logs.BeeLogger.SetLogger: " + err.Error())
... | go | func (bl *BeeLogger) SetLogger(adaptername string, config map[string]interface{}) error {
bl.lock.Lock()
defer bl.lock.Unlock()
if log, ok := adapters[adaptername]; ok {
lg := log()
err := lg.Init(config)
bl.outputs[adaptername] = lg
if err != nil {
fmt.Println("logs.BeeLogger.SetLogger: " + err.Error())
... | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"SetLogger",
"(",
"adaptername",
"string",
",",
"config",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"bl",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"bl",
".",
"lock",
"."... | // SetLogger provides a given logger adapter into BeeLogger with config string. | [
"SetLogger",
"provides",
"a",
"given",
"logger",
"adapter",
"into",
"BeeLogger",
"with",
"config",
"string",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L145-L160 | train |
henrylee2cn/pholcus | logs/logs/log.go | DelLogger | func (bl *BeeLogger) DelLogger(adaptername string) error {
bl.lock.Lock()
defer bl.lock.Unlock()
if lg, ok := bl.outputs[adaptername]; ok {
lg.Destroy()
delete(bl.outputs, adaptername)
return nil
} else {
return fmt.Errorf("logs: unknown adaptername %q (forgotten Register?)", adaptername)
}
} | go | func (bl *BeeLogger) DelLogger(adaptername string) error {
bl.lock.Lock()
defer bl.lock.Unlock()
if lg, ok := bl.outputs[adaptername]; ok {
lg.Destroy()
delete(bl.outputs, adaptername)
return nil
} else {
return fmt.Errorf("logs: unknown adaptername %q (forgotten Register?)", adaptername)
}
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"DelLogger",
"(",
"adaptername",
"string",
")",
"error",
"{",
"bl",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"bl",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"lg",
",",
"ok",
":=",
"bl",
... | // remove a logger adapter in BeeLogger. | [
"remove",
"a",
"logger",
"adapter",
"in",
"BeeLogger",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L163-L173 | train |
henrylee2cn/pholcus | logs/logs/log.go | App | func (bl *BeeLogger) App(format string, v ...interface{}) {
if LevelApp > bl.level {
return
}
msg := fmt.Sprintf("[P] "+format, v...)
bl.writerMsg(LevelApp, msg)
} | go | func (bl *BeeLogger) App(format string, v ...interface{}) {
if LevelApp > bl.level {
return
}
msg := fmt.Sprintf("[P] "+format, v...)
bl.writerMsg(LevelApp, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"App",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelApp",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
... | // Log APP level message. | [
"Log",
"APP",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L260-L266 | train |
henrylee2cn/pholcus | logs/logs/log.go | Emergency | func (bl *BeeLogger) Emergency(format string, v ...interface{}) {
if LevelEmergency > bl.level {
return
}
msg := fmt.Sprintf("[M] "+format, v...)
bl.writerMsg(LevelEmergency, msg)
} | go | func (bl *BeeLogger) Emergency(format string, v ...interface{}) {
if LevelEmergency > bl.level {
return
}
msg := fmt.Sprintf("[M] "+format, v...)
bl.writerMsg(LevelEmergency, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Emergency",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelEmergency",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"... | // Log EMERGENCY level message. | [
"Log",
"EMERGENCY",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L269-L275 | train |
henrylee2cn/pholcus | logs/logs/log.go | Alert | func (bl *BeeLogger) Alert(format string, v ...interface{}) {
if LevelAlert > bl.level {
return
}
msg := fmt.Sprintf("[A] "+format, v...)
bl.writerMsg(LevelAlert, msg)
} | go | func (bl *BeeLogger) Alert(format string, v ...interface{}) {
if LevelAlert > bl.level {
return
}
msg := fmt.Sprintf("[A] "+format, v...)
bl.writerMsg(LevelAlert, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Alert",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelAlert",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\... | // Log ALERT level message. | [
"Log",
"ALERT",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L278-L284 | train |
henrylee2cn/pholcus | logs/logs/log.go | Critical | func (bl *BeeLogger) Critical(format string, v ...interface{}) {
if LevelCritical > bl.level {
return
}
msg := fmt.Sprintf("[C] "+format, v...)
bl.writerMsg(LevelCritical, msg)
} | go | func (bl *BeeLogger) Critical(format string, v ...interface{}) {
if LevelCritical > bl.level {
return
}
msg := fmt.Sprintf("[C] "+format, v...)
bl.writerMsg(LevelCritical, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Critical",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelCritical",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"("... | // Log CRITICAL level message. | [
"Log",
"CRITICAL",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L287-L293 | train |
henrylee2cn/pholcus | logs/logs/log.go | Error | func (bl *BeeLogger) Error(format string, v ...interface{}) {
if LevelError > bl.level {
return
}
msg := fmt.Sprintf("[E] "+format, v...)
bl.writerMsg(LevelError, msg)
} | go | func (bl *BeeLogger) Error(format string, v ...interface{}) {
if LevelError > bl.level {
return
}
msg := fmt.Sprintf("[E] "+format, v...)
bl.writerMsg(LevelError, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Error",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelError",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\... | // Log ERROR level message. | [
"Log",
"ERROR",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L296-L302 | train |
henrylee2cn/pholcus | logs/logs/log.go | Warning | func (bl *BeeLogger) Warning(format string, v ...interface{}) {
if LevelWarning > bl.level {
return
}
msg := fmt.Sprintf("[W] "+format, v...)
bl.writerMsg(LevelWarning, msg)
} | go | func (bl *BeeLogger) Warning(format string, v ...interface{}) {
if LevelWarning > bl.level {
return
}
msg := fmt.Sprintf("[W] "+format, v...)
bl.writerMsg(LevelWarning, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Warning",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelWarning",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
... | // Log WARNING level message. | [
"Log",
"WARNING",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L305-L311 | train |
henrylee2cn/pholcus | logs/logs/log.go | Notice | func (bl *BeeLogger) Notice(format string, v ...interface{}) {
if LevelNotice > bl.level {
return
}
msg := fmt.Sprintf("[N] "+format, v...)
bl.writerMsg(LevelNotice, msg)
} | go | func (bl *BeeLogger) Notice(format string, v ...interface{}) {
if LevelNotice > bl.level {
return
}
msg := fmt.Sprintf("[N] "+format, v...)
bl.writerMsg(LevelNotice, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Notice",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelNotice",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
... | // Log NOTICE level message. | [
"Log",
"NOTICE",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L314-L320 | train |
henrylee2cn/pholcus | logs/logs/log.go | Informational | func (bl *BeeLogger) Informational(format string, v ...interface{}) {
if LevelInformational > bl.level {
return
}
msg := fmt.Sprintf("[I] "+format, v...)
bl.writerMsg(LevelInformational, msg)
} | go | func (bl *BeeLogger) Informational(format string, v ...interface{}) {
if LevelInformational > bl.level {
return
}
msg := fmt.Sprintf("[I] "+format, v...)
bl.writerMsg(LevelInformational, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Informational",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelInformational",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprin... | // Log INFORMATIONAL level message. | [
"Log",
"INFORMATIONAL",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L323-L329 | train |
henrylee2cn/pholcus | logs/logs/log.go | Debug | func (bl *BeeLogger) Debug(format string, v ...interface{}) {
if LevelDebug > bl.level {
return
}
msg := fmt.Sprintf("[D] "+format, v...)
bl.writerMsg(LevelDebug, msg)
} | go | func (bl *BeeLogger) Debug(format string, v ...interface{}) {
if LevelDebug > bl.level {
return
}
msg := fmt.Sprintf("[D] "+format, v...)
bl.writerMsg(LevelDebug, msg)
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Debug",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"LevelDebug",
">",
"bl",
".",
"level",
"{",
"return",
"\n",
"}",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\... | // Log DEBUG level message. | [
"Log",
"DEBUG",
"level",
"message",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L332-L338 | train |
henrylee2cn/pholcus | logs/logs/log.go | Close | func (bl *BeeLogger) Close() {
bl.lock.Lock()
bl.status = CLOSE
close(bl.steal)
bl.lock.Unlock()
bl.lock.RLock()
defer bl.lock.RUnlock()
for {
if len(bl.msg) > 0 {
bm := <-bl.msg
for _, l := range bl.outputs {
err := l.WriteMsg(bm.msg, bm.level)
if err != nil {
fmt.Println("ERROR, unable to... | go | func (bl *BeeLogger) Close() {
bl.lock.Lock()
bl.status = CLOSE
close(bl.steal)
bl.lock.Unlock()
bl.lock.RLock()
defer bl.lock.RUnlock()
for {
if len(bl.msg) > 0 {
bm := <-bl.msg
for _, l := range bl.outputs {
err := l.WriteMsg(bm.msg, bm.level)
if err != nil {
fmt.Println("ERROR, unable to... | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"Close",
"(",
")",
"{",
"bl",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"bl",
".",
"status",
"=",
"CLOSE",
"\n",
"close",
"(",
"bl",
".",
"steal",
")",
"\n",
"bl",
".",
"lock",
".",
"Unlock",
"(",
")"... | // close logger, flush all chan data and destroy all adapters in BeeLogger. | [
"close",
"logger",
"flush",
"all",
"chan",
"data",
"and",
"destroy",
"all",
"adapters",
"in",
"BeeLogger",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L348-L374 | train |
henrylee2cn/pholcus | logs/logs/log.go | EnableStealOne | func (bl *BeeLogger) EnableStealOne(enable bool) {
if enable {
bl.stealLevel = bl.stealLevelPreset
} else {
bl.stealLevel = LevelNothing
}
} | go | func (bl *BeeLogger) EnableStealOne(enable bool) {
if enable {
bl.stealLevel = bl.stealLevelPreset
} else {
bl.stealLevel = LevelNothing
}
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"EnableStealOne",
"(",
"enable",
"bool",
")",
"{",
"if",
"enable",
"{",
"bl",
".",
"stealLevel",
"=",
"bl",
".",
"stealLevelPreset",
"\n",
"}",
"else",
"{",
"bl",
".",
"stealLevel",
"=",
"LevelNothing",
"\n",
"... | // EnableStealOne set whether to enable steal-one. | [
"EnableStealOne",
"set",
"whether",
"to",
"enable",
"steal",
"-",
"one",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L391-L397 | train |
henrylee2cn/pholcus | logs/logs/log.go | StealOne | func (bl *BeeLogger) StealOne() (level int, msg string, ok bool) {
lm := <-bl.steal
if lm == nil {
return 0, "", false
}
return lm.level, lm.msg, true
} | go | func (bl *BeeLogger) StealOne() (level int, msg string, ok bool) {
lm := <-bl.steal
if lm == nil {
return 0, "", false
}
return lm.level, lm.msg, true
} | [
"func",
"(",
"bl",
"*",
"BeeLogger",
")",
"StealOne",
"(",
")",
"(",
"level",
"int",
",",
"msg",
"string",
",",
"ok",
"bool",
")",
"{",
"lm",
":=",
"<-",
"bl",
".",
"steal",
"\n",
"if",
"lm",
"==",
"nil",
"{",
"return",
"0",
",",
"\"",
"\"",
... | // get a log message | [
"get",
"a",
"log",
"message"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/log.go#L400-L406 | train |
henrylee2cn/pholcus | common/websocket/websocket.go | LocalAddr | func (ws *Conn) LocalAddr() net.Addr {
if ws.IsClientConn() {
return &Addr{ws.config.Origin}
}
return &Addr{ws.config.Location}
} | go | func (ws *Conn) LocalAddr() net.Addr {
if ws.IsClientConn() {
return &Addr{ws.config.Origin}
}
return &Addr{ws.config.Location}
} | [
"func",
"(",
"ws",
"*",
"Conn",
")",
"LocalAddr",
"(",
")",
"net",
".",
"Addr",
"{",
"if",
"ws",
".",
"IsClientConn",
"(",
")",
"{",
"return",
"&",
"Addr",
"{",
"ws",
".",
"config",
".",
"Origin",
"}",
"\n",
"}",
"\n",
"return",
"&",
"Addr",
"{... | // LocalAddr returns the WebSocket Origin for the connection for client, or
// the WebSocket location for server. | [
"LocalAddr",
"returns",
"the",
"WebSocket",
"Origin",
"for",
"the",
"connection",
"for",
"client",
"or",
"the",
"WebSocket",
"location",
"for",
"server",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/websocket/websocket.go#L230-L235 | train |
henrylee2cn/pholcus | common/websocket/websocket.go | SetDeadline | func (ws *Conn) SetDeadline(t time.Time) error {
if conn, ok := ws.rwc.(net.Conn); ok {
return conn.SetDeadline(t)
}
return errSetDeadline
} | go | func (ws *Conn) SetDeadline(t time.Time) error {
if conn, ok := ws.rwc.(net.Conn); ok {
return conn.SetDeadline(t)
}
return errSetDeadline
} | [
"func",
"(",
"ws",
"*",
"Conn",
")",
"SetDeadline",
"(",
"t",
"time",
".",
"Time",
")",
"error",
"{",
"if",
"conn",
",",
"ok",
":=",
"ws",
".",
"rwc",
".",
"(",
"net",
".",
"Conn",
")",
";",
"ok",
"{",
"return",
"conn",
".",
"SetDeadline",
"(",... | // SetDeadline sets the connection's network read & write deadlines. | [
"SetDeadline",
"sets",
"the",
"connection",
"s",
"network",
"read",
"&",
"write",
"deadlines",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/websocket/websocket.go#L249-L254 | train |
henrylee2cn/pholcus | common/websocket/websocket.go | Send | func (cd Codec) Send(ws *Conn, v interface{}) (n int, err error) {
data, payloadType, err := cd.Marshal(v)
if err != nil {
return 0, err
}
ws.wio.Lock()
defer ws.wio.Unlock()
w, err := ws.frameWriterFactory.NewFrameWriter(payloadType)
if err != nil {
return 0, err
}
n, err = w.Write(data)
w.Close()
retur... | go | func (cd Codec) Send(ws *Conn, v interface{}) (n int, err error) {
data, payloadType, err := cd.Marshal(v)
if err != nil {
return 0, err
}
ws.wio.Lock()
defer ws.wio.Unlock()
w, err := ws.frameWriterFactory.NewFrameWriter(payloadType)
if err != nil {
return 0, err
}
n, err = w.Write(data)
w.Close()
retur... | [
"func",
"(",
"cd",
"Codec",
")",
"Send",
"(",
"ws",
"*",
"Conn",
",",
"v",
"interface",
"{",
"}",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"data",
",",
"payloadType",
",",
"err",
":=",
"cd",
".",
"Marshal",
"(",
"v",
")",
"\n",
"i... | // Send sends v marshaled by cd.Marshal as single frame to ws. | [
"Send",
"sends",
"v",
"marshaled",
"by",
"cd",
".",
"Marshal",
"as",
"single",
"frame",
"to",
"ws",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/websocket/websocket.go#L286-L300 | train |
henrylee2cn/pholcus | common/websocket/websocket.go | Receive | func (cd Codec) Receive(ws *Conn, v interface{}) (err error) {
ws.rio.Lock()
defer ws.rio.Unlock()
if ws.frameReader != nil {
_, err = io.Copy(ioutil.Discard, ws.frameReader)
if err != nil {
return err
}
ws.frameReader = nil
}
again:
frame, err := ws.frameReaderFactory.NewFrameReader()
if err != nil {
... | go | func (cd Codec) Receive(ws *Conn, v interface{}) (err error) {
ws.rio.Lock()
defer ws.rio.Unlock()
if ws.frameReader != nil {
_, err = io.Copy(ioutil.Discard, ws.frameReader)
if err != nil {
return err
}
ws.frameReader = nil
}
again:
frame, err := ws.frameReaderFactory.NewFrameReader()
if err != nil {
... | [
"func",
"(",
"cd",
"Codec",
")",
"Receive",
"(",
"ws",
"*",
"Conn",
",",
"v",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"ws",
".",
"rio",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ws",
".",
"rio",
".",
"Unlock",
"(",
")",
"\n",
... | // Receive receives single frame from ws, unmarshaled by cd.Unmarshal and stores in v. | [
"Receive",
"receives",
"single",
"frame",
"from",
"ws",
"unmarshaled",
"by",
"cd",
".",
"Unmarshal",
"and",
"stores",
"in",
"v",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/websocket/websocket.go#L303-L331 | train |
henrylee2cn/pholcus | common/session/sess_utils.go | EncodeGob | func EncodeGob(obj map[interface{}]interface{}) ([]byte, error) {
for _, v := range obj {
gob.Register(v)
}
buf := bytes.NewBuffer(nil)
enc := gob.NewEncoder(buf)
err := enc.Encode(obj)
if err != nil {
return []byte(""), err
}
return buf.Bytes(), nil
} | go | func EncodeGob(obj map[interface{}]interface{}) ([]byte, error) {
for _, v := range obj {
gob.Register(v)
}
buf := bytes.NewBuffer(nil)
enc := gob.NewEncoder(buf)
err := enc.Encode(obj)
if err != nil {
return []byte(""), err
}
return buf.Bytes(), nil
} | [
"func",
"EncodeGob",
"(",
"obj",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"obj",
"{",
"gob",
".",
"Register",
"(",
"v",
")",
"\n",
... | // EncodeGob encode the obj to gob | [
"EncodeGob",
"encode",
"the",
"obj",
"to",
"gob"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/sess_utils.go#L46-L57 | train |
henrylee2cn/pholcus | common/session/sess_utils.go | generateRandomKey | func generateRandomKey(strength int) []byte {
k := make([]byte, strength)
if n, err := io.ReadFull(rand.Reader, k); n != strength || err != nil {
return RandomCreateBytes(strength)
}
return k
} | go | func generateRandomKey(strength int) []byte {
k := make([]byte, strength)
if n, err := io.ReadFull(rand.Reader, k); n != strength || err != nil {
return RandomCreateBytes(strength)
}
return k
} | [
"func",
"generateRandomKey",
"(",
"strength",
"int",
")",
"[",
"]",
"byte",
"{",
"k",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"strength",
")",
"\n",
"if",
"n",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"rand",
".",
"Reader",
",",
"k",
")",
... | // generateRandomKey creates a random key with the given strength. | [
"generateRandomKey",
"creates",
"a",
"random",
"key",
"with",
"the",
"given",
"strength",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/sess_utils.go#L72-L78 | train |
henrylee2cn/pholcus | common/mahonia/cp51932.go | init | func init() {
RegisterCharset(&Charset{
Name: "cp51932",
Aliases: []string{"windows-51932"},
NewDecoder: func() Decoder {
return decodeCP51932
},
NewEncoder: func() Encoder {
msJISTable.Reverse()
return encodeCP51932
},
})
} | go | func init() {
RegisterCharset(&Charset{
Name: "cp51932",
Aliases: []string{"windows-51932"},
NewDecoder: func() Decoder {
return decodeCP51932
},
NewEncoder: func() Encoder {
msJISTable.Reverse()
return encodeCP51932
},
})
} | [
"func",
"init",
"(",
")",
"{",
"RegisterCharset",
"(",
"&",
"Charset",
"{",
"Name",
":",
"\"",
"\"",
",",
"Aliases",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"NewDecoder",
":",
"func",
"(",
")",
"Decoder",
"{",
"return",
"decodeCP51932",
... | // Converters for Microsoft's version of the EUC-JP encoding | [
"Converters",
"for",
"Microsoft",
"s",
"version",
"of",
"the",
"EUC",
"-",
"JP",
"encoding"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/cp51932.go#L9-L21 | train |
henrylee2cn/pholcus | common/goquery/utilities.go | sliceContains | func sliceContains(container []*html.Node, contained *html.Node) bool {
for _, n := range container {
if nodeContains(n, contained) {
return true
}
}
return false
} | go | func sliceContains(container []*html.Node, contained *html.Node) bool {
for _, n := range container {
if nodeContains(n, contained) {
return true
}
}
return false
} | [
"func",
"sliceContains",
"(",
"container",
"[",
"]",
"*",
"html",
".",
"Node",
",",
"contained",
"*",
"html",
".",
"Node",
")",
"bool",
"{",
"for",
"_",
",",
"n",
":=",
"range",
"container",
"{",
"if",
"nodeContains",
"(",
"n",
",",
"contained",
")",... | // Loop through all container nodes to search for the target node. | [
"Loop",
"through",
"all",
"container",
"nodes",
"to",
"search",
"for",
"the",
"target",
"node",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/utilities.go#L71-L79 | train |
henrylee2cn/pholcus | common/goquery/utilities.go | nodeContains | func nodeContains(container *html.Node, contained *html.Node) bool {
// Check if the parent of the contained node is the container node, traversing
// upward until the top is reached, or the container is found.
for contained = contained.Parent; contained != nil; contained = contained.Parent {
if container == conta... | go | func nodeContains(container *html.Node, contained *html.Node) bool {
// Check if the parent of the contained node is the container node, traversing
// upward until the top is reached, or the container is found.
for contained = contained.Parent; contained != nil; contained = contained.Parent {
if container == conta... | [
"func",
"nodeContains",
"(",
"container",
"*",
"html",
".",
"Node",
",",
"contained",
"*",
"html",
".",
"Node",
")",
"bool",
"{",
"// Check if the parent of the contained node is the container node, traversing",
"// upward until the top is reached, or the container is found.",
... | // Checks if the contained node is within the container node. | [
"Checks",
"if",
"the",
"contained",
"node",
"is",
"within",
"the",
"container",
"node",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/utilities.go#L82-L91 | train |
henrylee2cn/pholcus | common/goquery/utilities.go | isInSlice | func isInSlice(slice []*html.Node, node *html.Node) bool {
return indexInSlice(slice, node) > -1
} | go | func isInSlice(slice []*html.Node, node *html.Node) bool {
return indexInSlice(slice, node) > -1
} | [
"func",
"isInSlice",
"(",
"slice",
"[",
"]",
"*",
"html",
".",
"Node",
",",
"node",
"*",
"html",
".",
"Node",
")",
"bool",
"{",
"return",
"indexInSlice",
"(",
"slice",
",",
"node",
")",
">",
"-",
"1",
"\n",
"}"
] | // Checks if the target node is in the slice of nodes. | [
"Checks",
"if",
"the",
"target",
"node",
"is",
"in",
"the",
"slice",
"of",
"nodes",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/utilities.go#L94-L96 | train |
henrylee2cn/pholcus | common/goquery/utilities.go | indexInSlice | func indexInSlice(slice []*html.Node, node *html.Node) int {
if node != nil {
for i, n := range slice {
if n == node {
return i
}
}
}
return -1
} | go | func indexInSlice(slice []*html.Node, node *html.Node) int {
if node != nil {
for i, n := range slice {
if n == node {
return i
}
}
}
return -1
} | [
"func",
"indexInSlice",
"(",
"slice",
"[",
"]",
"*",
"html",
".",
"Node",
",",
"node",
"*",
"html",
".",
"Node",
")",
"int",
"{",
"if",
"node",
"!=",
"nil",
"{",
"for",
"i",
",",
"n",
":=",
"range",
"slice",
"{",
"if",
"n",
"==",
"node",
"{",
... | // Returns the index of the target node in the slice, or -1. | [
"Returns",
"the",
"index",
"of",
"the",
"target",
"node",
"in",
"the",
"slice",
"or",
"-",
"1",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/utilities.go#L99-L108 | train |
henrylee2cn/pholcus | common/goquery/utilities.go | grep | func grep(sel *Selection, predicate func(i int, s *Selection) bool) (result []*html.Node) {
for i, n := range sel.Nodes {
if predicate(i, newSingleSelection(n, sel.document)) {
result = append(result, n)
}
}
return result
} | go | func grep(sel *Selection, predicate func(i int, s *Selection) bool) (result []*html.Node) {
for i, n := range sel.Nodes {
if predicate(i, newSingleSelection(n, sel.document)) {
result = append(result, n)
}
}
return result
} | [
"func",
"grep",
"(",
"sel",
"*",
"Selection",
",",
"predicate",
"func",
"(",
"i",
"int",
",",
"s",
"*",
"Selection",
")",
"bool",
")",
"(",
"result",
"[",
"]",
"*",
"html",
".",
"Node",
")",
"{",
"for",
"i",
",",
"n",
":=",
"range",
"sel",
".",... | // Loop through a selection, returning only those nodes that pass the predicate
// function. | [
"Loop",
"through",
"a",
"selection",
"returning",
"only",
"those",
"nodes",
"that",
"pass",
"the",
"predicate",
"function",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/utilities.go#L147-L154 | train |
henrylee2cn/pholcus | common/goquery/filter.go | Filter | func (s *Selection) Filter(selector string) *Selection {
return s.FilterMatcher(compileMatcher(selector))
} | go | func (s *Selection) Filter(selector string) *Selection {
return s.FilterMatcher(compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Filter",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"s",
".",
"FilterMatcher",
"(",
"compileMatcher",
"(",
"selector",
")",
")",
"\n",
"}"
] | // Filter reduces the set of matched elements to those that match the selector string.
// It returns a new Selection object for this subset of matching elements. | [
"Filter",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"match",
"the",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"for",
"this",
"subset",
"of",
"matching",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L7-L9 | train |
henrylee2cn/pholcus | common/goquery/filter.go | FilterMatcher | func (s *Selection) FilterMatcher(m Matcher) *Selection {
return pushStack(s, winnow(s, m, true))
} | go | func (s *Selection) FilterMatcher(m Matcher) *Selection {
return pushStack(s, winnow(s, m, true))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"FilterMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"winnow",
"(",
"s",
",",
"m",
",",
"true",
")",
")",
"\n",
"}"
] | // FilterMatcher reduces the set of matched elements to those that match
// the given matcher. It returns a new Selection object for this subset
// of matching elements. | [
"FilterMatcher",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"match",
"the",
"given",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"for",
"this",
"subset",
"of",
"matching",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L14-L16 | train |
henrylee2cn/pholcus | common/goquery/filter.go | Not | func (s *Selection) Not(selector string) *Selection {
return s.NotMatcher(compileMatcher(selector))
} | go | func (s *Selection) Not(selector string) *Selection {
return s.NotMatcher(compileMatcher(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Not",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"s",
".",
"NotMatcher",
"(",
"compileMatcher",
"(",
"selector",
")",
")",
"\n",
"}"
] | // Not removes elements from the Selection that match the selector string.
// It returns a new Selection object with the matching elements removed. | [
"Not",
"removes",
"elements",
"from",
"the",
"Selection",
"that",
"match",
"the",
"selector",
"string",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matching",
"elements",
"removed",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L20-L22 | train |
henrylee2cn/pholcus | common/goquery/filter.go | NotMatcher | func (s *Selection) NotMatcher(m Matcher) *Selection {
return pushStack(s, winnow(s, m, false))
} | go | func (s *Selection) NotMatcher(m Matcher) *Selection {
return pushStack(s, winnow(s, m, false))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NotMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"winnow",
"(",
"s",
",",
"m",
",",
"false",
")",
")",
"\n",
"}"
] | // NotMatcher removes elements from the Selection that match the given matcher.
// It returns a new Selection object with the matching elements removed. | [
"NotMatcher",
"removes",
"elements",
"from",
"the",
"Selection",
"that",
"match",
"the",
"given",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matching",
"elements",
"removed",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L26-L28 | train |
henrylee2cn/pholcus | common/goquery/filter.go | FilterFunction | func (s *Selection) FilterFunction(f func(int, *Selection) bool) *Selection {
return pushStack(s, winnowFunction(s, f, true))
} | go | func (s *Selection) FilterFunction(f func(int, *Selection) bool) *Selection {
return pushStack(s, winnowFunction(s, f, true))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"FilterFunction",
"(",
"f",
"func",
"(",
"int",
",",
"*",
"Selection",
")",
"bool",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"winnowFunction",
"(",
"s",
",",
"f",
",",
"true",
")",
"... | // FilterFunction reduces the set of matched elements to those that pass the function's test.
// It returns a new Selection object for this subset of elements. | [
"FilterFunction",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"pass",
"the",
"function",
"s",
"test",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"for",
"this",
"subset",
"of",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L32-L34 | train |
henrylee2cn/pholcus | common/goquery/filter.go | NotFunction | func (s *Selection) NotFunction(f func(int, *Selection) bool) *Selection {
return pushStack(s, winnowFunction(s, f, false))
} | go | func (s *Selection) NotFunction(f func(int, *Selection) bool) *Selection {
return pushStack(s, winnowFunction(s, f, false))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NotFunction",
"(",
"f",
"func",
"(",
"int",
",",
"*",
"Selection",
")",
"bool",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"winnowFunction",
"(",
"s",
",",
"f",
",",
"false",
")",
")"... | // NotFunction removes elements from the Selection that pass the function's test.
// It returns a new Selection object with the matching elements removed. | [
"NotFunction",
"removes",
"elements",
"from",
"the",
"Selection",
"that",
"pass",
"the",
"function",
"s",
"test",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matching",
"elements",
"removed",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L38-L40 | train |
henrylee2cn/pholcus | common/goquery/filter.go | FilterNodes | func (s *Selection) FilterNodes(nodes ...*html.Node) *Selection {
return pushStack(s, winnowNodes(s, nodes, true))
} | go | func (s *Selection) FilterNodes(nodes ...*html.Node) *Selection {
return pushStack(s, winnowNodes(s, nodes, true))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"FilterNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"winnowNodes",
"(",
"s",
",",
"nodes",
",",
"true",
")",
")",
"\n",
"}"
] | // FilterNodes reduces the set of matched elements to those that match the specified nodes.
// It returns a new Selection object for this subset of elements. | [
"FilterNodes",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"match",
"the",
"specified",
"nodes",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"for",
"this",
"subset",
"of",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L44-L46 | train |
henrylee2cn/pholcus | common/goquery/filter.go | NotNodes | func (s *Selection) NotNodes(nodes ...*html.Node) *Selection {
return pushStack(s, winnowNodes(s, nodes, false))
} | go | func (s *Selection) NotNodes(nodes ...*html.Node) *Selection {
return pushStack(s, winnowNodes(s, nodes, false))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NotNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"pushStack",
"(",
"s",
",",
"winnowNodes",
"(",
"s",
",",
"nodes",
",",
"false",
")",
")",
"\n",
"}"
] | // NotNodes removes elements from the Selection that match the specified nodes.
// It returns a new Selection object with the matching elements removed. | [
"NotNodes",
"removes",
"elements",
"from",
"the",
"Selection",
"that",
"match",
"the",
"specified",
"nodes",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matching",
"elements",
"removed",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L50-L52 | train |
henrylee2cn/pholcus | common/goquery/filter.go | FilterSelection | func (s *Selection) FilterSelection(sel *Selection) *Selection {
if sel == nil {
return pushStack(s, winnowNodes(s, nil, true))
}
return pushStack(s, winnowNodes(s, sel.Nodes, true))
} | go | func (s *Selection) FilterSelection(sel *Selection) *Selection {
if sel == nil {
return pushStack(s, winnowNodes(s, nil, true))
}
return pushStack(s, winnowNodes(s, sel.Nodes, true))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"FilterSelection",
"(",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"pushStack",
"(",
"s",
",",
"winnowNodes",
"(",
"s",
",",
"nil",
",",
"true",
")",
")",
"... | // FilterSelection reduces the set of matched elements to those that match a
// node in the specified Selection object.
// It returns a new Selection object for this subset of elements. | [
"FilterSelection",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"match",
"a",
"node",
"in",
"the",
"specified",
"Selection",
"object",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"for",
"this",
"subset",
"of",
"el... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L57-L62 | train |
henrylee2cn/pholcus | common/goquery/filter.go | NotSelection | func (s *Selection) NotSelection(sel *Selection) *Selection {
if sel == nil {
return pushStack(s, winnowNodes(s, nil, false))
}
return pushStack(s, winnowNodes(s, sel.Nodes, false))
} | go | func (s *Selection) NotSelection(sel *Selection) *Selection {
if sel == nil {
return pushStack(s, winnowNodes(s, nil, false))
}
return pushStack(s, winnowNodes(s, sel.Nodes, false))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"NotSelection",
"(",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"pushStack",
"(",
"s",
",",
"winnowNodes",
"(",
"s",
",",
"nil",
",",
"false",
")",
")",
"\n... | // NotSelection removes elements from the Selection that match a node in the specified
// Selection object. It returns a new Selection object with the matching elements removed. | [
"NotSelection",
"removes",
"elements",
"from",
"the",
"Selection",
"that",
"match",
"a",
"node",
"in",
"the",
"specified",
"Selection",
"object",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matching",
"elements",
"removed",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L66-L71 | train |
henrylee2cn/pholcus | common/goquery/filter.go | Has | func (s *Selection) Has(selector string) *Selection {
return s.HasSelection(s.document.Find(selector))
} | go | func (s *Selection) Has(selector string) *Selection {
return s.HasSelection(s.document.Find(selector))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Has",
"(",
"selector",
"string",
")",
"*",
"Selection",
"{",
"return",
"s",
".",
"HasSelection",
"(",
"s",
".",
"document",
".",
"Find",
"(",
"selector",
")",
")",
"\n",
"}"
] | // Has reduces the set of matched elements to those that have a descendant
// that matches the selector.
// It returns a new Selection object with the matching elements. | [
"Has",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"have",
"a",
"descendant",
"that",
"matches",
"the",
"selector",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matching",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L81-L83 | train |
henrylee2cn/pholcus | common/goquery/filter.go | HasMatcher | func (s *Selection) HasMatcher(m Matcher) *Selection {
return s.HasSelection(s.document.FindMatcher(m))
} | go | func (s *Selection) HasMatcher(m Matcher) *Selection {
return s.HasSelection(s.document.FindMatcher(m))
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"HasMatcher",
"(",
"m",
"Matcher",
")",
"*",
"Selection",
"{",
"return",
"s",
".",
"HasSelection",
"(",
"s",
".",
"document",
".",
"FindMatcher",
"(",
"m",
")",
")",
"\n",
"}"
] | // HasMatcher reduces the set of matched elements to those that have a descendant
// that matches the matcher.
// It returns a new Selection object with the matching elements. | [
"HasMatcher",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"have",
"a",
"descendant",
"that",
"matches",
"the",
"matcher",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matching",
"elements",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L88-L90 | train |
henrylee2cn/pholcus | common/goquery/filter.go | HasNodes | func (s *Selection) HasNodes(nodes ...*html.Node) *Selection {
return s.FilterFunction(func(_ int, sel *Selection) bool {
// Add all nodes that contain one of the specified nodes
for _, n := range nodes {
if sel.Contains(n) {
return true
}
}
return false
})
} | go | func (s *Selection) HasNodes(nodes ...*html.Node) *Selection {
return s.FilterFunction(func(_ int, sel *Selection) bool {
// Add all nodes that contain one of the specified nodes
for _, n := range nodes {
if sel.Contains(n) {
return true
}
}
return false
})
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"HasNodes",
"(",
"nodes",
"...",
"*",
"html",
".",
"Node",
")",
"*",
"Selection",
"{",
"return",
"s",
".",
"FilterFunction",
"(",
"func",
"(",
"_",
"int",
",",
"sel",
"*",
"Selection",
")",
"bool",
"{",
"// ... | // HasNodes reduces the set of matched elements to those that have a
// descendant that matches one of the nodes.
// It returns a new Selection object with the matching elements. | [
"HasNodes",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"have",
"a",
"descendant",
"that",
"matches",
"one",
"of",
"the",
"nodes",
".",
"It",
"returns",
"a",
"new",
"Selection",
"object",
"with",
"the",
"matching",
"elements"... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L95-L105 | train |
henrylee2cn/pholcus | common/goquery/filter.go | HasSelection | func (s *Selection) HasSelection(sel *Selection) *Selection {
if sel == nil {
return s.HasNodes()
}
return s.HasNodes(sel.Nodes...)
} | go | func (s *Selection) HasSelection(sel *Selection) *Selection {
if sel == nil {
return s.HasNodes()
}
return s.HasNodes(sel.Nodes...)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"HasSelection",
"(",
"sel",
"*",
"Selection",
")",
"*",
"Selection",
"{",
"if",
"sel",
"==",
"nil",
"{",
"return",
"s",
".",
"HasNodes",
"(",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"HasNodes",
"(",
"sel",... | // HasSelection reduces the set of matched elements to those that have a
// descendant that matches one of the nodes of the specified Selection object.
// It returns a new Selection object with the matching elements. | [
"HasSelection",
"reduces",
"the",
"set",
"of",
"matched",
"elements",
"to",
"those",
"that",
"have",
"a",
"descendant",
"that",
"matches",
"one",
"of",
"the",
"nodes",
"of",
"the",
"specified",
"Selection",
"object",
".",
"It",
"returns",
"a",
"new",
"Select... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L110-L115 | train |
henrylee2cn/pholcus | common/goquery/filter.go | End | func (s *Selection) End() *Selection {
if s.prevSel != nil {
return s.prevSel
}
return newEmptySelection(s.document)
} | go | func (s *Selection) End() *Selection {
if s.prevSel != nil {
return s.prevSel
}
return newEmptySelection(s.document)
} | [
"func",
"(",
"s",
"*",
"Selection",
")",
"End",
"(",
")",
"*",
"Selection",
"{",
"if",
"s",
".",
"prevSel",
"!=",
"nil",
"{",
"return",
"s",
".",
"prevSel",
"\n",
"}",
"\n",
"return",
"newEmptySelection",
"(",
"s",
".",
"document",
")",
"\n",
"}"
] | // End ends the most recent filtering operation in the current chain and
// returns the set of matched elements to its previous state. | [
"End",
"ends",
"the",
"most",
"recent",
"filtering",
"operation",
"in",
"the",
"current",
"chain",
"and",
"returns",
"the",
"set",
"of",
"matched",
"elements",
"to",
"its",
"previous",
"state",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/filter.go#L119-L124 | train |
henrylee2cn/pholcus | web/logsocketController.go | wsLogHandle | func wsLogHandle(conn *ws.Conn) {
defer func() {
if p := recover(); p != nil {
logs.Log.Error("%v", p)
}
}()
// var err error
sess, _ := globalSessions.SessionStart(nil, conn.Request())
sessID := sess.SessionID()
connPool := Lsc.connPool.Load().(map[string]*ws.Conn)
if connPool[sessID] == nil {
Lsc.Add(... | go | func wsLogHandle(conn *ws.Conn) {
defer func() {
if p := recover(); p != nil {
logs.Log.Error("%v", p)
}
}()
// var err error
sess, _ := globalSessions.SessionStart(nil, conn.Request())
sessID := sess.SessionID()
connPool := Lsc.connPool.Load().(map[string]*ws.Conn)
if connPool[sessID] == nil {
Lsc.Add(... | [
"func",
"wsLogHandle",
"(",
"conn",
"*",
"ws",
".",
"Conn",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"p",
":=",
"recover",
"(",
")",
";",
"p",
"!=",
"nil",
"{",
"logs",
".",
"Log",
".",
"Error",
"(",
"\"",
"\"",
",",
"p",
")",
"\n",
... | // send log api | [
"send",
"log",
"api"
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/web/logsocketController.go#L13-L34 | train |
henrylee2cn/pholcus | common/session/session.go | Register | func Register(name string, provide Provider) {
if provide == nil {
panic("session: Register provide is nil")
}
if _, dup := provides[name]; dup {
panic("session: Register called twice for provider " + name)
}
provides[name] = provide
} | go | func Register(name string, provide Provider) {
if provide == nil {
panic("session: Register provide is nil")
}
if _, dup := provides[name]; dup {
panic("session: Register called twice for provider " + name)
}
provides[name] = provide
} | [
"func",
"Register",
"(",
"name",
"string",
",",
"provide",
"Provider",
")",
"{",
"if",
"provide",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"dup",
":=",
"provides",
"[",
"name",
"]",
";",
"dup",
"{",
"panic... | // Register makes a session provide available by the provided name.
// If Register is called twice with the same name or if driver is nil,
// it panics. | [
"Register",
"makes",
"a",
"session",
"provide",
"available",
"by",
"the",
"provided",
"name",
".",
"If",
"Register",
"is",
"called",
"twice",
"with",
"the",
"same",
"name",
"or",
"if",
"driver",
"is",
"nil",
"it",
"panics",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/session.go#L75-L83 | train |
henrylee2cn/pholcus | common/session/session.go | getSid | func (manager *Manager) getSid(r *http.Request) (string, error) {
cookie, errs := r.Cookie(manager.config.CookieName)
if errs != nil || cookie.Value == "" || cookie.MaxAge < 0 {
var sid string
if manager.config.EnableSidInUrlQuery {
errs := r.ParseForm()
if errs != nil {
return "", errs
}
sid = r... | go | func (manager *Manager) getSid(r *http.Request) (string, error) {
cookie, errs := r.Cookie(manager.config.CookieName)
if errs != nil || cookie.Value == "" || cookie.MaxAge < 0 {
var sid string
if manager.config.EnableSidInUrlQuery {
errs := r.ParseForm()
if errs != nil {
return "", errs
}
sid = r... | [
"func",
"(",
"manager",
"*",
"Manager",
")",
"getSid",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"string",
",",
"error",
")",
"{",
"cookie",
",",
"errs",
":=",
"r",
".",
"Cookie",
"(",
"manager",
".",
"config",
".",
"CookieName",
")",
"\n",
... | // getSid retrieves session identifier from HTTP Request.
// First try to retrieve id by reading from cookie, session cookie name is configurable,
// if not exist, then retrieve id from querying parameters.
//
// error is not nil when there is anything wrong.
// sid is empty when need to generate a new session id
// ot... | [
"getSid",
"retrieves",
"session",
"identifier",
"from",
"HTTP",
"Request",
".",
"First",
"try",
"to",
"retrieve",
"id",
"by",
"reading",
"from",
"cookie",
"session",
"cookie",
"name",
"is",
"configurable",
"if",
"not",
"exist",
"then",
"retrieve",
"id",
"from"... | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/session.go#L170-L196 | train |
henrylee2cn/pholcus | common/session/session.go | SessionDestroy | func (manager *Manager) SessionDestroy(w http.ResponseWriter, r *http.Request) {
if manager.config.EnableSidInHttpHeader {
r.Header.Del(manager.config.SessionNameInHttpHeader)
w.Header().Del(manager.config.SessionNameInHttpHeader)
}
cookie, err := r.Cookie(manager.config.CookieName)
if err != nil || cookie.Val... | go | func (manager *Manager) SessionDestroy(w http.ResponseWriter, r *http.Request) {
if manager.config.EnableSidInHttpHeader {
r.Header.Del(manager.config.SessionNameInHttpHeader)
w.Header().Del(manager.config.SessionNameInHttpHeader)
}
cookie, err := r.Cookie(manager.config.CookieName)
if err != nil || cookie.Val... | [
"func",
"(",
"manager",
"*",
"Manager",
")",
"SessionDestroy",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"manager",
".",
"config",
".",
"EnableSidInHttpHeader",
"{",
"r",
".",
"Header",
".",
"Del",
... | // SessionDestroy Destroy session by its id in http request cookie. | [
"SessionDestroy",
"Destroy",
"session",
"by",
"its",
"id",
"in",
"http",
"request",
"cookie",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/session.go#L243-L266 | train |
henrylee2cn/pholcus | common/session/session.go | GetSessionStore | func (manager *Manager) GetSessionStore(sid string) (sessions Store, err error) {
sessions, err = manager.provider.SessionRead(sid)
return
} | go | func (manager *Manager) GetSessionStore(sid string) (sessions Store, err error) {
sessions, err = manager.provider.SessionRead(sid)
return
} | [
"func",
"(",
"manager",
"*",
"Manager",
")",
"GetSessionStore",
"(",
"sid",
"string",
")",
"(",
"sessions",
"Store",
",",
"err",
"error",
")",
"{",
"sessions",
",",
"err",
"=",
"manager",
".",
"provider",
".",
"SessionRead",
"(",
"sid",
")",
"\n",
"ret... | // GetSessionStore Get SessionStore by its id. | [
"GetSessionStore",
"Get",
"SessionStore",
"by",
"its",
"id",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/session.go#L269-L272 | train |
henrylee2cn/pholcus | common/session/session.go | GC | func (manager *Manager) GC() {
manager.provider.SessionGC()
time.AfterFunc(time.Duration(manager.config.Gclifetime)*time.Second, func() { manager.GC() })
} | go | func (manager *Manager) GC() {
manager.provider.SessionGC()
time.AfterFunc(time.Duration(manager.config.Gclifetime)*time.Second, func() { manager.GC() })
} | [
"func",
"(",
"manager",
"*",
"Manager",
")",
"GC",
"(",
")",
"{",
"manager",
".",
"provider",
".",
"SessionGC",
"(",
")",
"\n",
"time",
".",
"AfterFunc",
"(",
"time",
".",
"Duration",
"(",
"manager",
".",
"config",
".",
"Gclifetime",
")",
"*",
"time"... | // GC Start session gc process.
// it can do gc in times after gc lifetime. | [
"GC",
"Start",
"session",
"gc",
"process",
".",
"it",
"can",
"do",
"gc",
"in",
"times",
"after",
"gc",
"lifetime",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/session.go#L276-L279 | train |
henrylee2cn/pholcus | common/session/session.go | SessionRegenerateID | func (manager *Manager) SessionRegenerateID(w http.ResponseWriter, r *http.Request) (session Store) {
sid, err := manager.sessionID()
if err != nil {
return
}
cookie, err := r.Cookie(manager.config.CookieName)
if err != nil || cookie.Value == "" {
//delete old cookie
session, _ = manager.provider.SessionRead... | go | func (manager *Manager) SessionRegenerateID(w http.ResponseWriter, r *http.Request) (session Store) {
sid, err := manager.sessionID()
if err != nil {
return
}
cookie, err := r.Cookie(manager.config.CookieName)
if err != nil || cookie.Value == "" {
//delete old cookie
session, _ = manager.provider.SessionRead... | [
"func",
"(",
"manager",
"*",
"Manager",
")",
"SessionRegenerateID",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"session",
"Store",
")",
"{",
"sid",
",",
"err",
":=",
"manager",
".",
"sessionID",
"(",
")",
... | // SessionRegenerateID Regenerate a session id for this SessionStore who's id is saving in http request. | [
"SessionRegenerateID",
"Regenerate",
"a",
"session",
"id",
"for",
"this",
"SessionStore",
"who",
"s",
"id",
"is",
"saving",
"in",
"http",
"request",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/session.go#L282-L320 | train |
henrylee2cn/pholcus | common/session/session.go | isSecure | func (manager *Manager) isSecure(req *http.Request) bool {
if !manager.config.Secure {
return false
}
if req.URL.Scheme != "" {
return req.URL.Scheme == "https"
}
if req.TLS == nil {
return false
}
return true
} | go | func (manager *Manager) isSecure(req *http.Request) bool {
if !manager.config.Secure {
return false
}
if req.URL.Scheme != "" {
return req.URL.Scheme == "https"
}
if req.TLS == nil {
return false
}
return true
} | [
"func",
"(",
"manager",
"*",
"Manager",
")",
"isSecure",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"bool",
"{",
"if",
"!",
"manager",
".",
"config",
".",
"Secure",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"req",
".",
"URL",
".",
"Scheme",... | // Set cookie with https. | [
"Set",
"cookie",
"with",
"https",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/session.go#L342-L353 | train |
henrylee2cn/pholcus | common/session/session.go | NewSessionLog | func NewSessionLog(out io.Writer) *Log {
sl := new(Log)
sl.Logger = log.New(out, "[SESSION]", 1e9)
return sl
} | go | func NewSessionLog(out io.Writer) *Log {
sl := new(Log)
sl.Logger = log.New(out, "[SESSION]", 1e9)
return sl
} | [
"func",
"NewSessionLog",
"(",
"out",
"io",
".",
"Writer",
")",
"*",
"Log",
"{",
"sl",
":=",
"new",
"(",
"Log",
")",
"\n",
"sl",
".",
"Logger",
"=",
"log",
".",
"New",
"(",
"out",
",",
"\"",
"\"",
",",
"1e9",
")",
"\n",
"return",
"sl",
"\n",
"... | // NewSessionLog set io.Writer to create a Logger for session. | [
"NewSessionLog",
"set",
"io",
".",
"Writer",
"to",
"create",
"a",
"Logger",
"for",
"session",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/session/session.go#L361-L365 | train |
henrylee2cn/pholcus | logs/logs/console.go | NewConsole | func NewConsole() LoggerInterface {
cw := &ConsoleWriter{
Level: LevelDebug,
lg: log.New(os.Stdout, "", log.LstdFlags),
}
return cw
} | go | func NewConsole() LoggerInterface {
cw := &ConsoleWriter{
Level: LevelDebug,
lg: log.New(os.Stdout, "", log.LstdFlags),
}
return cw
} | [
"func",
"NewConsole",
"(",
")",
"LoggerInterface",
"{",
"cw",
":=",
"&",
"ConsoleWriter",
"{",
"Level",
":",
"LevelDebug",
",",
"lg",
":",
"log",
".",
"New",
"(",
"os",
".",
"Stdout",
",",
"\"",
"\"",
",",
"log",
".",
"LstdFlags",
")",
",",
"}",
"\... | // create ConsoleWriter returning as LoggerInterface. | [
"create",
"ConsoleWriter",
"returning",
"as",
"LoggerInterface",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/console.go#L54-L60 | train |
henrylee2cn/pholcus | logs/logs/console.go | WriteMsg | func (c *ConsoleWriter) WriteMsg(msg string, level int) error {
if level > c.Level {
return nil
}
if goos := runtime.GOOS; goos == "windows" {
c.lg.Println(msg)
return nil
}
c.lg.Println(colors[level](msg))
return nil
} | go | func (c *ConsoleWriter) WriteMsg(msg string, level int) error {
if level > c.Level {
return nil
}
if goos := runtime.GOOS; goos == "windows" {
c.lg.Println(msg)
return nil
}
c.lg.Println(colors[level](msg))
return nil
} | [
"func",
"(",
"c",
"*",
"ConsoleWriter",
")",
"WriteMsg",
"(",
"msg",
"string",
",",
"level",
"int",
")",
"error",
"{",
"if",
"level",
">",
"c",
".",
"Level",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"goos",
":=",
"runtime",
".",
"GOOS",
";",
... | // write message in console. | [
"write",
"message",
"in",
"console",
"."
] | 5e73d3ff534090b22e8dde1950abe5d0fce5f746 | https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/logs/logs/console.go#L84-L95 | train |
ory/hydra | sdk/go/hydra/models/swagger_revoke_o_auth2_token_parameters.go | Validate | func (m *SwaggerRevokeOAuth2TokenParameters) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateToken(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | go | func (m *SwaggerRevokeOAuth2TokenParameters) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateToken(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
"func",
"(",
"m",
"*",
"SwaggerRevokeOAuth2TokenParameters",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateToken",
"(",
"formats",
")",
";",
"... | // Validate validates this swagger revoke o auth2 token parameters | [
"Validate",
"validates",
"this",
"swagger",
"revoke",
"o",
"auth2",
"token",
"parameters"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/models/swagger_revoke_o_auth2_token_parameters.go#L26-L37 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_consent_request_parameters.go | WithTimeout | func (o *AcceptConsentRequestParams) WithTimeout(timeout time.Duration) *AcceptConsentRequestParams {
o.SetTimeout(timeout)
return o
} | go | func (o *AcceptConsentRequestParams) WithTimeout(timeout time.Duration) *AcceptConsentRequestParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptConsentRequestParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"AcceptConsentRequestParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the accept consent request params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"accept",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_consent_request_parameters.go#L77-L80 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_consent_request_parameters.go | WithContext | func (o *AcceptConsentRequestParams) WithContext(ctx context.Context) *AcceptConsentRequestParams {
o.SetContext(ctx)
return o
} | go | func (o *AcceptConsentRequestParams) WithContext(ctx context.Context) *AcceptConsentRequestParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptConsentRequestParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"AcceptConsentRequestParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the accept consent request params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"accept",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_consent_request_parameters.go#L88-L91 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_consent_request_parameters.go | WithHTTPClient | func (o *AcceptConsentRequestParams) WithHTTPClient(client *http.Client) *AcceptConsentRequestParams {
o.SetHTTPClient(client)
return o
} | go | func (o *AcceptConsentRequestParams) WithHTTPClient(client *http.Client) *AcceptConsentRequestParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptConsentRequestParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"AcceptConsentRequestParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the accept consent request params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"accept",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_consent_request_parameters.go#L99-L102 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_consent_request_parameters.go | WithBody | func (o *AcceptConsentRequestParams) WithBody(body *models.HandledConsentRequest) *AcceptConsentRequestParams {
o.SetBody(body)
return o
} | go | func (o *AcceptConsentRequestParams) WithBody(body *models.HandledConsentRequest) *AcceptConsentRequestParams {
o.SetBody(body)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptConsentRequestParams",
")",
"WithBody",
"(",
"body",
"*",
"models",
".",
"HandledConsentRequest",
")",
"*",
"AcceptConsentRequestParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithBody adds the body to the accept consent request params | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"accept",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_consent_request_parameters.go#L110-L113 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_consent_request_parameters.go | WithConsentChallenge | func (o *AcceptConsentRequestParams) WithConsentChallenge(consentChallenge string) *AcceptConsentRequestParams {
o.SetConsentChallenge(consentChallenge)
return o
} | go | func (o *AcceptConsentRequestParams) WithConsentChallenge(consentChallenge string) *AcceptConsentRequestParams {
o.SetConsentChallenge(consentChallenge)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptConsentRequestParams",
")",
"WithConsentChallenge",
"(",
"consentChallenge",
"string",
")",
"*",
"AcceptConsentRequestParams",
"{",
"o",
".",
"SetConsentChallenge",
"(",
"consentChallenge",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithConsentChallenge adds the consentChallenge to the accept consent request params | [
"WithConsentChallenge",
"adds",
"the",
"consentChallenge",
"to",
"the",
"accept",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_consent_request_parameters.go#L121-L124 | train |
ory/hydra | sdk/go/hydra/client/admin/delete_o_auth2_client_parameters.go | WithTimeout | func (o *DeleteOAuth2ClientParams) WithTimeout(timeout time.Duration) *DeleteOAuth2ClientParams {
o.SetTimeout(timeout)
return o
} | go | func (o *DeleteOAuth2ClientParams) WithTimeout(timeout time.Duration) *DeleteOAuth2ClientParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"DeleteOAuth2ClientParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"DeleteOAuth2ClientParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the delete o auth2 client params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"delete",
"o",
"auth2",
"client",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/delete_o_auth2_client_parameters.go#L76-L79 | train |
ory/hydra | sdk/go/hydra/client/admin/delete_o_auth2_client_parameters.go | WithContext | func (o *DeleteOAuth2ClientParams) WithContext(ctx context.Context) *DeleteOAuth2ClientParams {
o.SetContext(ctx)
return o
} | go | func (o *DeleteOAuth2ClientParams) WithContext(ctx context.Context) *DeleteOAuth2ClientParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"DeleteOAuth2ClientParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"DeleteOAuth2ClientParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the delete o auth2 client params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"delete",
"o",
"auth2",
"client",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/delete_o_auth2_client_parameters.go#L87-L90 | train |
ory/hydra | sdk/go/hydra/client/admin/delete_o_auth2_client_parameters.go | WithHTTPClient | func (o *DeleteOAuth2ClientParams) WithHTTPClient(client *http.Client) *DeleteOAuth2ClientParams {
o.SetHTTPClient(client)
return o
} | go | func (o *DeleteOAuth2ClientParams) WithHTTPClient(client *http.Client) *DeleteOAuth2ClientParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"DeleteOAuth2ClientParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"DeleteOAuth2ClientParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the delete o auth2 client params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"delete",
"o",
"auth2",
"client",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/delete_o_auth2_client_parameters.go#L98-L101 | train |
ory/hydra | sdk/go/hydra/client/admin/delete_o_auth2_client_parameters.go | WithID | func (o *DeleteOAuth2ClientParams) WithID(id string) *DeleteOAuth2ClientParams {
o.SetID(id)
return o
} | go | func (o *DeleteOAuth2ClientParams) WithID(id string) *DeleteOAuth2ClientParams {
o.SetID(id)
return o
} | [
"func",
"(",
"o",
"*",
"DeleteOAuth2ClientParams",
")",
"WithID",
"(",
"id",
"string",
")",
"*",
"DeleteOAuth2ClientParams",
"{",
"o",
".",
"SetID",
"(",
"id",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithID adds the id to the delete o auth2 client params | [
"WithID",
"adds",
"the",
"id",
"to",
"the",
"delete",
"o",
"auth2",
"client",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/delete_o_auth2_client_parameters.go#L109-L112 | train |
ory/hydra | sdk/go/hydra/client/public/userinfo_parameters.go | WithTimeout | func (o *UserinfoParams) WithTimeout(timeout time.Duration) *UserinfoParams {
o.SetTimeout(timeout)
return o
} | go | func (o *UserinfoParams) WithTimeout(timeout time.Duration) *UserinfoParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"UserinfoParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"UserinfoParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the userinfo params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"userinfo",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/public/userinfo_parameters.go#L69-L72 | train |
ory/hydra | sdk/go/hydra/client/public/userinfo_parameters.go | WithContext | func (o *UserinfoParams) WithContext(ctx context.Context) *UserinfoParams {
o.SetContext(ctx)
return o
} | go | func (o *UserinfoParams) WithContext(ctx context.Context) *UserinfoParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"UserinfoParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"UserinfoParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the userinfo params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"userinfo",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/public/userinfo_parameters.go#L80-L83 | train |
ory/hydra | sdk/go/hydra/client/public/userinfo_parameters.go | WithHTTPClient | func (o *UserinfoParams) WithHTTPClient(client *http.Client) *UserinfoParams {
o.SetHTTPClient(client)
return o
} | go | func (o *UserinfoParams) WithHTTPClient(client *http.Client) *UserinfoParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"UserinfoParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"UserinfoParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the userinfo params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"userinfo",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/public/userinfo_parameters.go#L91-L94 | train |
ory/hydra | sdk/go/hydra/models/swagger_jwk_update_set.go | Validate | func (m *SwaggerJwkUpdateSet) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBody(formats); err != nil {
res = append(res, err)
}
if err := m.validateSet(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
ret... | go | func (m *SwaggerJwkUpdateSet) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBody(formats); err != nil {
res = append(res, err)
}
if err := m.validateSet(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
ret... | [
"func",
"(",
"m",
"*",
"SwaggerJwkUpdateSet",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateBody",
"(",
"formats",
")",
";",
"err",
"!=",
... | // Validate validates this swagger jwk update set | [
"Validate",
"validates",
"this",
"swagger",
"jwk",
"update",
"set"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/models/swagger_jwk_update_set.go#L30-L45 | train |
ory/hydra | sdk/go/hydra/client/admin/create_o_auth2_client_parameters.go | WithTimeout | func (o *CreateOAuth2ClientParams) WithTimeout(timeout time.Duration) *CreateOAuth2ClientParams {
o.SetTimeout(timeout)
return o
} | go | func (o *CreateOAuth2ClientParams) WithTimeout(timeout time.Duration) *CreateOAuth2ClientParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"CreateOAuth2ClientParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"CreateOAuth2ClientParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the create o auth2 client params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"create",
"o",
"auth2",
"client",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/create_o_auth2_client_parameters.go#L75-L78 | train |
ory/hydra | sdk/go/hydra/client/admin/create_o_auth2_client_parameters.go | WithContext | func (o *CreateOAuth2ClientParams) WithContext(ctx context.Context) *CreateOAuth2ClientParams {
o.SetContext(ctx)
return o
} | go | func (o *CreateOAuth2ClientParams) WithContext(ctx context.Context) *CreateOAuth2ClientParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"CreateOAuth2ClientParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"CreateOAuth2ClientParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the create o auth2 client params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"create",
"o",
"auth2",
"client",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/create_o_auth2_client_parameters.go#L86-L89 | train |
ory/hydra | sdk/go/hydra/client/admin/create_o_auth2_client_parameters.go | WithHTTPClient | func (o *CreateOAuth2ClientParams) WithHTTPClient(client *http.Client) *CreateOAuth2ClientParams {
o.SetHTTPClient(client)
return o
} | go | func (o *CreateOAuth2ClientParams) WithHTTPClient(client *http.Client) *CreateOAuth2ClientParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"CreateOAuth2ClientParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"CreateOAuth2ClientParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the create o auth2 client params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"create",
"o",
"auth2",
"client",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/create_o_auth2_client_parameters.go#L97-L100 | train |
ory/hydra | sdk/go/hydra/client/admin/create_o_auth2_client_parameters.go | WithBody | func (o *CreateOAuth2ClientParams) WithBody(body *models.Client) *CreateOAuth2ClientParams {
o.SetBody(body)
return o
} | go | func (o *CreateOAuth2ClientParams) WithBody(body *models.Client) *CreateOAuth2ClientParams {
o.SetBody(body)
return o
} | [
"func",
"(",
"o",
"*",
"CreateOAuth2ClientParams",
")",
"WithBody",
"(",
"body",
"*",
"models",
".",
"Client",
")",
"*",
"CreateOAuth2ClientParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithBody adds the body to the create o auth2 client params | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"create",
"o",
"auth2",
"client",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/create_o_auth2_client_parameters.go#L108-L111 | train |
ory/hydra | sdk/go/hydra/client/health/is_instance_alive_parameters.go | WithTimeout | func (o *IsInstanceAliveParams) WithTimeout(timeout time.Duration) *IsInstanceAliveParams {
o.SetTimeout(timeout)
return o
} | go | func (o *IsInstanceAliveParams) WithTimeout(timeout time.Duration) *IsInstanceAliveParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"IsInstanceAliveParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"IsInstanceAliveParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the is instance alive params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"is",
"instance",
"alive",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/health/is_instance_alive_parameters.go#L69-L72 | train |
ory/hydra | sdk/go/hydra/client/health/is_instance_alive_parameters.go | WithContext | func (o *IsInstanceAliveParams) WithContext(ctx context.Context) *IsInstanceAliveParams {
o.SetContext(ctx)
return o
} | go | func (o *IsInstanceAliveParams) WithContext(ctx context.Context) *IsInstanceAliveParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"IsInstanceAliveParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"IsInstanceAliveParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the is instance alive params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"is",
"instance",
"alive",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/health/is_instance_alive_parameters.go#L80-L83 | train |
ory/hydra | sdk/go/hydra/client/health/is_instance_alive_parameters.go | WithHTTPClient | func (o *IsInstanceAliveParams) WithHTTPClient(client *http.Client) *IsInstanceAliveParams {
o.SetHTTPClient(client)
return o
} | go | func (o *IsInstanceAliveParams) WithHTTPClient(client *http.Client) *IsInstanceAliveParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"IsInstanceAliveParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"IsInstanceAliveParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the is instance alive params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"is",
"instance",
"alive",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/health/is_instance_alive_parameters.go#L91-L94 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_login_request_parameters.go | WithTimeout | func (o *AcceptLoginRequestParams) WithTimeout(timeout time.Duration) *AcceptLoginRequestParams {
o.SetTimeout(timeout)
return o
} | go | func (o *AcceptLoginRequestParams) WithTimeout(timeout time.Duration) *AcceptLoginRequestParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptLoginRequestParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"AcceptLoginRequestParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the accept login request params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"accept",
"login",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_login_request_parameters.go#L77-L80 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_login_request_parameters.go | WithContext | func (o *AcceptLoginRequestParams) WithContext(ctx context.Context) *AcceptLoginRequestParams {
o.SetContext(ctx)
return o
} | go | func (o *AcceptLoginRequestParams) WithContext(ctx context.Context) *AcceptLoginRequestParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptLoginRequestParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"AcceptLoginRequestParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the accept login request params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"accept",
"login",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_login_request_parameters.go#L88-L91 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_login_request_parameters.go | WithHTTPClient | func (o *AcceptLoginRequestParams) WithHTTPClient(client *http.Client) *AcceptLoginRequestParams {
o.SetHTTPClient(client)
return o
} | go | func (o *AcceptLoginRequestParams) WithHTTPClient(client *http.Client) *AcceptLoginRequestParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptLoginRequestParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"AcceptLoginRequestParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the accept login request params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"accept",
"login",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_login_request_parameters.go#L99-L102 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_login_request_parameters.go | WithBody | func (o *AcceptLoginRequestParams) WithBody(body *models.HandledLoginRequest) *AcceptLoginRequestParams {
o.SetBody(body)
return o
} | go | func (o *AcceptLoginRequestParams) WithBody(body *models.HandledLoginRequest) *AcceptLoginRequestParams {
o.SetBody(body)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptLoginRequestParams",
")",
"WithBody",
"(",
"body",
"*",
"models",
".",
"HandledLoginRequest",
")",
"*",
"AcceptLoginRequestParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithBody adds the body to the accept login request params | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"accept",
"login",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_login_request_parameters.go#L110-L113 | train |
ory/hydra | sdk/go/hydra/client/admin/accept_login_request_parameters.go | WithLoginChallenge | func (o *AcceptLoginRequestParams) WithLoginChallenge(loginChallenge string) *AcceptLoginRequestParams {
o.SetLoginChallenge(loginChallenge)
return o
} | go | func (o *AcceptLoginRequestParams) WithLoginChallenge(loginChallenge string) *AcceptLoginRequestParams {
o.SetLoginChallenge(loginChallenge)
return o
} | [
"func",
"(",
"o",
"*",
"AcceptLoginRequestParams",
")",
"WithLoginChallenge",
"(",
"loginChallenge",
"string",
")",
"*",
"AcceptLoginRequestParams",
"{",
"o",
".",
"SetLoginChallenge",
"(",
"loginChallenge",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithLoginChallenge adds the loginChallenge to the accept login request params | [
"WithLoginChallenge",
"adds",
"the",
"loginChallenge",
"to",
"the",
"accept",
"login",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/accept_login_request_parameters.go#L121-L124 | train |
ory/hydra | sdk/go/hydra/models/well_known.go | Validate | func (m *WellKnown) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAuthURL(formats); err != nil {
res = append(res, err)
}
if err := m.validateIDTokenSigningAlgValuesSupported(formats); err != nil {
res = append(res, err)
}
if err := m.validateIssuer(formats); err != nil {
... | go | func (m *WellKnown) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAuthURL(formats); err != nil {
res = append(res, err)
}
if err := m.validateIDTokenSigningAlgValuesSupported(formats); err != nil {
res = append(res, err)
}
if err := m.validateIssuer(formats); err != nil {
... | [
"func",
"(",
"m",
"*",
"WellKnown",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateAuthURL",
"(",
"formats",
")",
";",
"err",
"!=",
"nil",
... | // Validate validates this well known | [
"Validate",
"validates",
"this",
"well",
"known"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/models/well_known.go#L125-L160 | train |
ory/hydra | sdk/go/hydra/client/admin/get_consent_request_parameters.go | WithTimeout | func (o *GetConsentRequestParams) WithTimeout(timeout time.Duration) *GetConsentRequestParams {
o.SetTimeout(timeout)
return o
} | go | func (o *GetConsentRequestParams) WithTimeout(timeout time.Duration) *GetConsentRequestParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"GetConsentRequestParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"GetConsentRequestParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the get consent request params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"get",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/get_consent_request_parameters.go#L73-L76 | train |
ory/hydra | sdk/go/hydra/client/admin/get_consent_request_parameters.go | WithContext | func (o *GetConsentRequestParams) WithContext(ctx context.Context) *GetConsentRequestParams {
o.SetContext(ctx)
return o
} | go | func (o *GetConsentRequestParams) WithContext(ctx context.Context) *GetConsentRequestParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"GetConsentRequestParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"GetConsentRequestParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the get consent request params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"get",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/get_consent_request_parameters.go#L84-L87 | train |
ory/hydra | sdk/go/hydra/client/admin/get_consent_request_parameters.go | WithHTTPClient | func (o *GetConsentRequestParams) WithHTTPClient(client *http.Client) *GetConsentRequestParams {
o.SetHTTPClient(client)
return o
} | go | func (o *GetConsentRequestParams) WithHTTPClient(client *http.Client) *GetConsentRequestParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"GetConsentRequestParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"GetConsentRequestParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the get consent request params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"get",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/get_consent_request_parameters.go#L95-L98 | train |
ory/hydra | sdk/go/hydra/client/admin/get_consent_request_parameters.go | WithConsentChallenge | func (o *GetConsentRequestParams) WithConsentChallenge(consentChallenge string) *GetConsentRequestParams {
o.SetConsentChallenge(consentChallenge)
return o
} | go | func (o *GetConsentRequestParams) WithConsentChallenge(consentChallenge string) *GetConsentRequestParams {
o.SetConsentChallenge(consentChallenge)
return o
} | [
"func",
"(",
"o",
"*",
"GetConsentRequestParams",
")",
"WithConsentChallenge",
"(",
"consentChallenge",
"string",
")",
"*",
"GetConsentRequestParams",
"{",
"o",
".",
"SetConsentChallenge",
"(",
"consentChallenge",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithConsentChallenge adds the consentChallenge to the get consent request params | [
"WithConsentChallenge",
"adds",
"the",
"consentChallenge",
"to",
"the",
"get",
"consent",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/get_consent_request_parameters.go#L106-L109 | train |
ory/hydra | sdk/go/hydra/client/admin/admin_client.go | New | func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
} | go | func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
} | [
"func",
"New",
"(",
"transport",
"runtime",
".",
"ClientTransport",
",",
"formats",
"strfmt",
".",
"Registry",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"transport",
":",
"transport",
",",
"formats",
":",
"formats",
"}",
"\n",
"}"
] | // New creates a new admin API client. | [
"New",
"creates",
"a",
"new",
"admin",
"API",
"client",
"."
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/admin_client.go#L15-L17 | train |
ory/hydra | sdk/go/hydra/client/admin/get_logout_request_parameters.go | WithTimeout | func (o *GetLogoutRequestParams) WithTimeout(timeout time.Duration) *GetLogoutRequestParams {
o.SetTimeout(timeout)
return o
} | go | func (o *GetLogoutRequestParams) WithTimeout(timeout time.Duration) *GetLogoutRequestParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"GetLogoutRequestParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"GetLogoutRequestParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the get logout request params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"get",
"logout",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/get_logout_request_parameters.go#L73-L76 | train |
ory/hydra | sdk/go/hydra/client/admin/get_logout_request_parameters.go | WithContext | func (o *GetLogoutRequestParams) WithContext(ctx context.Context) *GetLogoutRequestParams {
o.SetContext(ctx)
return o
} | go | func (o *GetLogoutRequestParams) WithContext(ctx context.Context) *GetLogoutRequestParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"GetLogoutRequestParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"GetLogoutRequestParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the get logout request params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"get",
"logout",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/get_logout_request_parameters.go#L84-L87 | train |
ory/hydra | sdk/go/hydra/client/admin/get_logout_request_parameters.go | WithHTTPClient | func (o *GetLogoutRequestParams) WithHTTPClient(client *http.Client) *GetLogoutRequestParams {
o.SetHTTPClient(client)
return o
} | go | func (o *GetLogoutRequestParams) WithHTTPClient(client *http.Client) *GetLogoutRequestParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"GetLogoutRequestParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"GetLogoutRequestParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the get logout request params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"get",
"logout",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/get_logout_request_parameters.go#L95-L98 | train |
ory/hydra | sdk/go/hydra/client/admin/get_logout_request_parameters.go | WithLogoutChallenge | func (o *GetLogoutRequestParams) WithLogoutChallenge(logoutChallenge string) *GetLogoutRequestParams {
o.SetLogoutChallenge(logoutChallenge)
return o
} | go | func (o *GetLogoutRequestParams) WithLogoutChallenge(logoutChallenge string) *GetLogoutRequestParams {
o.SetLogoutChallenge(logoutChallenge)
return o
} | [
"func",
"(",
"o",
"*",
"GetLogoutRequestParams",
")",
"WithLogoutChallenge",
"(",
"logoutChallenge",
"string",
")",
"*",
"GetLogoutRequestParams",
"{",
"o",
".",
"SetLogoutChallenge",
"(",
"logoutChallenge",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithLogoutChallenge adds the logoutChallenge to the get logout request params | [
"WithLogoutChallenge",
"adds",
"the",
"logoutChallenge",
"to",
"the",
"get",
"logout",
"request",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/get_logout_request_parameters.go#L106-L109 | train |
ory/hydra | sdk/go/hydra/client/admin/delete_json_web_key_parameters.go | WithTimeout | func (o *DeleteJSONWebKeyParams) WithTimeout(timeout time.Duration) *DeleteJSONWebKeyParams {
o.SetTimeout(timeout)
return o
} | go | func (o *DeleteJSONWebKeyParams) WithTimeout(timeout time.Duration) *DeleteJSONWebKeyParams {
o.SetTimeout(timeout)
return o
} | [
"func",
"(",
"o",
"*",
"DeleteJSONWebKeyParams",
")",
"WithTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"DeleteJSONWebKeyParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithTimeout adds the timeout to the delete Json web key params | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"delete",
"Json",
"web",
"key",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/delete_json_web_key_parameters.go#L81-L84 | train |
ory/hydra | sdk/go/hydra/client/admin/delete_json_web_key_parameters.go | WithContext | func (o *DeleteJSONWebKeyParams) WithContext(ctx context.Context) *DeleteJSONWebKeyParams {
o.SetContext(ctx)
return o
} | go | func (o *DeleteJSONWebKeyParams) WithContext(ctx context.Context) *DeleteJSONWebKeyParams {
o.SetContext(ctx)
return o
} | [
"func",
"(",
"o",
"*",
"DeleteJSONWebKeyParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"DeleteJSONWebKeyParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithContext adds the context to the delete Json web key params | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"delete",
"Json",
"web",
"key",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/delete_json_web_key_parameters.go#L92-L95 | train |
ory/hydra | sdk/go/hydra/client/admin/delete_json_web_key_parameters.go | WithHTTPClient | func (o *DeleteJSONWebKeyParams) WithHTTPClient(client *http.Client) *DeleteJSONWebKeyParams {
o.SetHTTPClient(client)
return o
} | go | func (o *DeleteJSONWebKeyParams) WithHTTPClient(client *http.Client) *DeleteJSONWebKeyParams {
o.SetHTTPClient(client)
return o
} | [
"func",
"(",
"o",
"*",
"DeleteJSONWebKeyParams",
")",
"WithHTTPClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"DeleteJSONWebKeyParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] | // WithHTTPClient adds the HTTPClient to the delete Json web key params | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"delete",
"Json",
"web",
"key",
"params"
] | 67c246c177446daab64be00ba82b3aea1a546570 | https://github.com/ory/hydra/blob/67c246c177446daab64be00ba82b3aea1a546570/sdk/go/hydra/client/admin/delete_json_web_key_parameters.go#L103-L106 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.