id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
134,200
henrylee2cn/pholcus
common/goquery/traversal.go
NextFilteredUntilSelection
func (s *Selection) NextFilteredUntilSelection(filterSelector string, sel *Selection) *Selection { return s.NextMatcherUntilSelection(compileMatcher(filterSelector), sel) }
go
func (s *Selection) NextFilteredUntilSelection(filterSelector string, sel *Selection) *Selection { return s.NextMatcherUntilSelection(compileMatcher(filterSelector), sel) }
[ "func", "(", "s", "*", "Selection", ")", "NextFilteredUntilSelection", "(", "filterSelector", "string", ",", "sel", "*", "Selection", ")", "*", "Selection", "{", "return", "s", ".", "NextMatcherUntilSelection", "(", "compileMatcher", "(", "filterSelector", ")", ...
// NextFilteredUntilSelection is like NextUntilSelection, with the // option to filter the results based on a selector string. It returns a new // Selection object containing the matched elements.
[ "NextFilteredUntilSelection", "is", "like", "NextUntilSelection", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "selector", "string", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "element...
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L452-L454
134,201
henrylee2cn/pholcus
common/goquery/traversal.go
NextMatcherUntilSelection
func (s *Selection) NextMatcherUntilSelection(filter Matcher, sel *Selection) *Selection { if sel == nil { return s.NextMatcher(filter) } return s.NextMatcherUntilNodes(filter, sel.Nodes...) }
go
func (s *Selection) NextMatcherUntilSelection(filter Matcher, sel *Selection) *Selection { if sel == nil { return s.NextMatcher(filter) } return s.NextMatcherUntilNodes(filter, sel.Nodes...) }
[ "func", "(", "s", "*", "Selection", ")", "NextMatcherUntilSelection", "(", "filter", "Matcher", ",", "sel", "*", "Selection", ")", "*", "Selection", "{", "if", "sel", "==", "nil", "{", "return", "s", ".", "NextMatcher", "(", "filter", ")", "\n", "}", "...
// NextMatcherUntilSelection is like NextUntilSelection, with the // option to filter the results based on a matcher. It returns a new // Selection object containing the matched elements.
[ "NextMatcherUntilSelection", "is", "like", "NextUntilSelection", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "matcher", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "elements", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L459-L464
134,202
henrylee2cn/pholcus
common/goquery/traversal.go
NextFilteredUntilNodes
func (s *Selection) NextFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil, nil, nodes), compileMatcher(filterSelector)) }
go
func (s *Selection) NextFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil, nil, nodes), compileMatcher(filterSelector)) }
[ "func", "(", "s", "*", "Selection", ")", "NextFilteredUntilNodes", "(", "filterSelector", "string", ",", "nodes", "...", "*", "html", ".", "Node", ")", "*", "Selection", "{", "return", "filterAndPush", "(", "s", ",", "getSiblingNodes", "(", "s", ".", "Node...
// NextFilteredUntilNodes is like NextUntilNodes, with the // option to filter the results based on a selector string. It returns a new // Selection object containing the matched elements.
[ "NextFilteredUntilNodes", "is", "like", "NextUntilNodes", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "selector", "string", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "elements", "....
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L469-L472
134,203
henrylee2cn/pholcus
common/goquery/traversal.go
NextMatcherUntilNodes
func (s *Selection) NextMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil, nil, nodes), filter) }
go
func (s *Selection) NextMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingNextUntil, nil, nodes), filter) }
[ "func", "(", "s", "*", "Selection", ")", "NextMatcherUntilNodes", "(", "filter", "Matcher", ",", "nodes", "...", "*", "html", ".", "Node", ")", "*", "Selection", "{", "return", "filterAndPush", "(", "s", ",", "getSiblingNodes", "(", "s", ".", "Nodes", ",...
// NextMatcherUntilNodes is like NextUntilNodes, with the // option to filter the results based on a matcher. It returns a new // Selection object containing the matched elements.
[ "NextMatcherUntilNodes", "is", "like", "NextUntilNodes", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "matcher", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "elements", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L477-L480
134,204
henrylee2cn/pholcus
common/goquery/traversal.go
PrevFilteredUntil
func (s *Selection) PrevFilteredUntil(filterSelector, untilSelector string) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil, compileMatcher(untilSelector), nil), compileMatcher(filterSelector)) }
go
func (s *Selection) PrevFilteredUntil(filterSelector, untilSelector string) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil, compileMatcher(untilSelector), nil), compileMatcher(filterSelector)) }
[ "func", "(", "s", "*", "Selection", ")", "PrevFilteredUntil", "(", "filterSelector", ",", "untilSelector", "string", ")", "*", "Selection", "{", "return", "filterAndPush", "(", "s", ",", "getSiblingNodes", "(", "s", ".", "Nodes", ",", "siblingPrevUntil", ",", ...
// PrevFilteredUntil is like PrevUntil, with the option to filter // the results based on a selector string. // It returns a new Selection object containing the matched elements.
[ "PrevFilteredUntil", "is", "like", "PrevUntil", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "selector", "string", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "elements", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L485-L488
134,205
henrylee2cn/pholcus
common/goquery/traversal.go
PrevFilteredUntilMatcher
func (s *Selection) PrevFilteredUntilMatcher(filter, until Matcher) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil, until, nil), filter) }
go
func (s *Selection) PrevFilteredUntilMatcher(filter, until Matcher) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil, until, nil), filter) }
[ "func", "(", "s", "*", "Selection", ")", "PrevFilteredUntilMatcher", "(", "filter", ",", "until", "Matcher", ")", "*", "Selection", "{", "return", "filterAndPush", "(", "s", ",", "getSiblingNodes", "(", "s", ".", "Nodes", ",", "siblingPrevUntil", ",", "until...
// PrevFilteredUntilMatcher is like PrevUntilMatcher, with the option to filter // the results based on a matcher. // It returns a new Selection object containing the matched elements.
[ "PrevFilteredUntilMatcher", "is", "like", "PrevUntilMatcher", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "matcher", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "elements", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L493-L496
134,206
henrylee2cn/pholcus
common/goquery/traversal.go
PrevFilteredUntilSelection
func (s *Selection) PrevFilteredUntilSelection(filterSelector string, sel *Selection) *Selection { return s.PrevMatcherUntilSelection(compileMatcher(filterSelector), sel) }
go
func (s *Selection) PrevFilteredUntilSelection(filterSelector string, sel *Selection) *Selection { return s.PrevMatcherUntilSelection(compileMatcher(filterSelector), sel) }
[ "func", "(", "s", "*", "Selection", ")", "PrevFilteredUntilSelection", "(", "filterSelector", "string", ",", "sel", "*", "Selection", ")", "*", "Selection", "{", "return", "s", ".", "PrevMatcherUntilSelection", "(", "compileMatcher", "(", "filterSelector", ")", ...
// PrevFilteredUntilSelection is like PrevUntilSelection, with the // option to filter the results based on a selector string. It returns a new // Selection object containing the matched elements.
[ "PrevFilteredUntilSelection", "is", "like", "PrevUntilSelection", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "selector", "string", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "element...
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L501-L503
134,207
henrylee2cn/pholcus
common/goquery/traversal.go
PrevMatcherUntilSelection
func (s *Selection) PrevMatcherUntilSelection(filter Matcher, sel *Selection) *Selection { if sel == nil { return s.PrevMatcher(filter) } return s.PrevMatcherUntilNodes(filter, sel.Nodes...) }
go
func (s *Selection) PrevMatcherUntilSelection(filter Matcher, sel *Selection) *Selection { if sel == nil { return s.PrevMatcher(filter) } return s.PrevMatcherUntilNodes(filter, sel.Nodes...) }
[ "func", "(", "s", "*", "Selection", ")", "PrevMatcherUntilSelection", "(", "filter", "Matcher", ",", "sel", "*", "Selection", ")", "*", "Selection", "{", "if", "sel", "==", "nil", "{", "return", "s", ".", "PrevMatcher", "(", "filter", ")", "\n", "}", "...
// PrevMatcherUntilSelection is like PrevUntilSelection, with the // option to filter the results based on a matcher. It returns a new // Selection object containing the matched elements.
[ "PrevMatcherUntilSelection", "is", "like", "PrevUntilSelection", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "matcher", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "elements", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L508-L513
134,208
henrylee2cn/pholcus
common/goquery/traversal.go
PrevFilteredUntilNodes
func (s *Selection) PrevFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil, nil, nodes), compileMatcher(filterSelector)) }
go
func (s *Selection) PrevFilteredUntilNodes(filterSelector string, nodes ...*html.Node) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil, nil, nodes), compileMatcher(filterSelector)) }
[ "func", "(", "s", "*", "Selection", ")", "PrevFilteredUntilNodes", "(", "filterSelector", "string", ",", "nodes", "...", "*", "html", ".", "Node", ")", "*", "Selection", "{", "return", "filterAndPush", "(", "s", ",", "getSiblingNodes", "(", "s", ".", "Node...
// PrevFilteredUntilNodes is like PrevUntilNodes, with the // option to filter the results based on a selector string. It returns a new // Selection object containing the matched elements.
[ "PrevFilteredUntilNodes", "is", "like", "PrevUntilNodes", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "selector", "string", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "elements", "....
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L518-L521
134,209
henrylee2cn/pholcus
common/goquery/traversal.go
PrevMatcherUntilNodes
func (s *Selection) PrevMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil, nil, nodes), filter) }
go
func (s *Selection) PrevMatcherUntilNodes(filter Matcher, nodes ...*html.Node) *Selection { return filterAndPush(s, getSiblingNodes(s.Nodes, siblingPrevUntil, nil, nodes), filter) }
[ "func", "(", "s", "*", "Selection", ")", "PrevMatcherUntilNodes", "(", "filter", "Matcher", ",", "nodes", "...", "*", "html", ".", "Node", ")", "*", "Selection", "{", "return", "filterAndPush", "(", "s", ",", "getSiblingNodes", "(", "s", ".", "Nodes", ",...
// PrevMatcherUntilNodes is like PrevUntilNodes, with the // option to filter the results based on a matcher. It returns a new // Selection object containing the matched elements.
[ "PrevMatcherUntilNodes", "is", "like", "PrevUntilNodes", "with", "the", "option", "to", "filter", "the", "results", "based", "on", "a", "matcher", ".", "It", "returns", "a", "new", "Selection", "object", "containing", "the", "matched", "elements", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L526-L529
134,210
henrylee2cn/pholcus
common/goquery/traversal.go
filterAndPush
func filterAndPush(srcSel *Selection, nodes []*html.Node, m Matcher) *Selection { // Create a temporary Selection with the specified nodes to filter using winnow sel := &Selection{nodes, srcSel.document, nil} // Filter based on matcher and push on stack return pushStack(srcSel, winnow(sel, m, true)) }
go
func filterAndPush(srcSel *Selection, nodes []*html.Node, m Matcher) *Selection { // Create a temporary Selection with the specified nodes to filter using winnow sel := &Selection{nodes, srcSel.document, nil} // Filter based on matcher and push on stack return pushStack(srcSel, winnow(sel, m, true)) }
[ "func", "filterAndPush", "(", "srcSel", "*", "Selection", ",", "nodes", "[", "]", "*", "html", ".", "Node", ",", "m", "Matcher", ")", "*", "Selection", "{", "// Create a temporary Selection with the specified nodes to filter using winnow", "sel", ":=", "&", "Selecti...
// Filter and push filters the nodes based on a matcher, and pushes the results // on the stack, with the srcSel as previous selection.
[ "Filter", "and", "push", "filters", "the", "nodes", "based", "on", "a", "matcher", "and", "pushes", "the", "results", "on", "the", "stack", "with", "the", "srcSel", "as", "previous", "selection", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L533-L538
134,211
henrylee2cn/pholcus
common/goquery/traversal.go
findWithMatcher
func findWithMatcher(nodes []*html.Node, m Matcher) []*html.Node { // Map nodes to find the matches within the children of each node return mapNodes(nodes, func(i int, n *html.Node) (result []*html.Node) { // Go down one level, becausejQuery's Find selects only within descendants for c := n.FirstChild; c != nil; ...
go
func findWithMatcher(nodes []*html.Node, m Matcher) []*html.Node { // Map nodes to find the matches within the children of each node return mapNodes(nodes, func(i int, n *html.Node) (result []*html.Node) { // Go down one level, becausejQuery's Find selects only within descendants for c := n.FirstChild; c != nil; ...
[ "func", "findWithMatcher", "(", "nodes", "[", "]", "*", "html", ".", "Node", ",", "m", "Matcher", ")", "[", "]", "*", "html", ".", "Node", "{", "// Map nodes to find the matches within the children of each node", "return", "mapNodes", "(", "nodes", ",", "func", ...
// Internal implementation of Find that return raw nodes.
[ "Internal", "implementation", "of", "Find", "that", "return", "raw", "nodes", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L541-L552
134,212
henrylee2cn/pholcus
common/goquery/traversal.go
getSiblingNodes
func getSiblingNodes(nodes []*html.Node, st siblingType, untilm Matcher, untilNodes []*html.Node) []*html.Node { var f func(*html.Node) bool // If the requested siblings are ...Until, create the test function to // determine if the until condition is reached (returns true if it is) if st == siblingNextUntil || st ...
go
func getSiblingNodes(nodes []*html.Node, st siblingType, untilm Matcher, untilNodes []*html.Node) []*html.Node { var f func(*html.Node) bool // If the requested siblings are ...Until, create the test function to // determine if the until condition is reached (returns true if it is) if st == siblingNextUntil || st ...
[ "func", "getSiblingNodes", "(", "nodes", "[", "]", "*", "html", ".", "Node", ",", "st", "siblingType", ",", "untilm", "Matcher", ",", "untilNodes", "[", "]", "*", "html", ".", "Node", ")", "[", "]", "*", "html", ".", "Node", "{", "var", "f", "func"...
// Internal implementation of sibling nodes that return a raw slice of matches.
[ "Internal", "implementation", "of", "sibling", "nodes", "that", "return", "a", "raw", "slice", "of", "matches", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L578-L601
134,213
henrylee2cn/pholcus
common/goquery/traversal.go
getChildrenNodes
func getChildrenNodes(nodes []*html.Node, st siblingType) []*html.Node { return mapNodes(nodes, func(i int, n *html.Node) []*html.Node { return getChildrenWithSiblingType(n, st, nil, nil) }) }
go
func getChildrenNodes(nodes []*html.Node, st siblingType) []*html.Node { return mapNodes(nodes, func(i int, n *html.Node) []*html.Node { return getChildrenWithSiblingType(n, st, nil, nil) }) }
[ "func", "getChildrenNodes", "(", "nodes", "[", "]", "*", "html", ".", "Node", ",", "st", "siblingType", ")", "[", "]", "*", "html", ".", "Node", "{", "return", "mapNodes", "(", "nodes", ",", "func", "(", "i", "int", ",", "n", "*", "html", ".", "N...
// Gets the children nodes of each node in the specified slice of nodes, // based on the sibling type request.
[ "Gets", "the", "children", "nodes", "of", "each", "node", "in", "the", "specified", "slice", "of", "nodes", "based", "on", "the", "sibling", "type", "request", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L605-L609
134,214
henrylee2cn/pholcus
common/goquery/traversal.go
getChildrenWithSiblingType
func getChildrenWithSiblingType(parent *html.Node, st siblingType, skipNode *html.Node, untilFunc func(*html.Node) bool) (result []*html.Node) { // Create the iterator function var iter = func(cur *html.Node) (ret *html.Node) { // Based on the sibling type requested, iterate the right way for { switch st { ...
go
func getChildrenWithSiblingType(parent *html.Node, st siblingType, skipNode *html.Node, untilFunc func(*html.Node) bool) (result []*html.Node) { // Create the iterator function var iter = func(cur *html.Node) (ret *html.Node) { // Based on the sibling type requested, iterate the right way for { switch st { ...
[ "func", "getChildrenWithSiblingType", "(", "parent", "*", "html", ".", "Node", ",", "st", "siblingType", ",", "skipNode", "*", "html", ".", "Node", ",", "untilFunc", "func", "(", "*", "html", ".", "Node", ")", "bool", ")", "(", "result", "[", "]", "*",...
// Gets the children of the specified parent, based on the requested sibling // type, skipping a specified node if required.
[ "Gets", "the", "children", "of", "the", "specified", "parent", "based", "on", "the", "requested", "sibling", "type", "skipping", "a", "specified", "node", "if", "required", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L613-L674
134,215
henrylee2cn/pholcus
common/goquery/traversal.go
getParentNodes
func getParentNodes(nodes []*html.Node) []*html.Node { return mapNodes(nodes, func(i int, n *html.Node) []*html.Node { if n.Parent != nil && n.Parent.Type == html.ElementNode { return []*html.Node{n.Parent} } return nil }) }
go
func getParentNodes(nodes []*html.Node) []*html.Node { return mapNodes(nodes, func(i int, n *html.Node) []*html.Node { if n.Parent != nil && n.Parent.Type == html.ElementNode { return []*html.Node{n.Parent} } return nil }) }
[ "func", "getParentNodes", "(", "nodes", "[", "]", "*", "html", ".", "Node", ")", "[", "]", "*", "html", ".", "Node", "{", "return", "mapNodes", "(", "nodes", ",", "func", "(", "i", "int", ",", "n", "*", "html", ".", "Node", ")", "[", "]", "*", ...
// Internal implementation of parent nodes that return a raw slice of Nodes.
[ "Internal", "implementation", "of", "parent", "nodes", "that", "return", "a", "raw", "slice", "of", "Nodes", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L677-L684
134,216
henrylee2cn/pholcus
common/goquery/traversal.go
mapNodes
func mapNodes(nodes []*html.Node, f func(int, *html.Node) []*html.Node) (result []*html.Node) { set := make(map[*html.Node]bool) for i, n := range nodes { if vals := f(i, n); len(vals) > 0 { result = appendWithoutDuplicates(result, vals, set) } } return result }
go
func mapNodes(nodes []*html.Node, f func(int, *html.Node) []*html.Node) (result []*html.Node) { set := make(map[*html.Node]bool) for i, n := range nodes { if vals := f(i, n); len(vals) > 0 { result = appendWithoutDuplicates(result, vals, set) } } return result }
[ "func", "mapNodes", "(", "nodes", "[", "]", "*", "html", ".", "Node", ",", "f", "func", "(", "int", ",", "*", "html", ".", "Node", ")", "[", "]", "*", "html", ".", "Node", ")", "(", "result", "[", "]", "*", "html", ".", "Node", ")", "{", "s...
// Internal map function used by many traversing methods. Takes the source nodes // to iterate on and the mapping function that returns an array of nodes. // Returns an array of nodes mapped by calling the callback function once for // each node in the source nodes.
[ "Internal", "map", "function", "used", "by", "many", "traversing", "methods", ".", "Takes", "the", "source", "nodes", "to", "iterate", "on", "and", "the", "mapping", "function", "that", "returns", "an", "array", "of", "nodes", ".", "Returns", "an", "array", ...
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/traversal.go#L690-L698
134,217
henrylee2cn/pholcus
common/goquery/array.go
Eq
func (s *Selection) Eq(index int) *Selection { if index < 0 { index += len(s.Nodes) } if index >= len(s.Nodes) || index < 0 { return newEmptySelection(s.document) } return s.Slice(index, index+1) }
go
func (s *Selection) Eq(index int) *Selection { if index < 0 { index += len(s.Nodes) } if index >= len(s.Nodes) || index < 0 { return newEmptySelection(s.document) } return s.Slice(index, index+1) }
[ "func", "(", "s", "*", "Selection", ")", "Eq", "(", "index", "int", ")", "*", "Selection", "{", "if", "index", "<", "0", "{", "index", "+=", "len", "(", "s", ".", "Nodes", ")", "\n", "}", "\n\n", "if", "index", ">=", "len", "(", "s", ".", "No...
// Eq reduces the set of matched elements to the one at the specified index. // If a negative index is given, it counts backwards starting at the end of the // set. It returns a new Selection object, and an empty Selection object if the // index is invalid.
[ "Eq", "reduces", "the", "set", "of", "matched", "elements", "to", "the", "one", "at", "the", "specified", "index", ".", "If", "a", "negative", "index", "is", "given", "it", "counts", "backwards", "starting", "at", "the", "end", "of", "the", "set", ".", ...
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L25-L35
134,218
henrylee2cn/pholcus
common/goquery/array.go
Slice
func (s *Selection) Slice(start, end int) *Selection { if start < 0 { start += len(s.Nodes) } if end < 0 { end += len(s.Nodes) } return pushStack(s, s.Nodes[start:end]) }
go
func (s *Selection) Slice(start, end int) *Selection { if start < 0 { start += len(s.Nodes) } if end < 0 { end += len(s.Nodes) } return pushStack(s, s.Nodes[start:end]) }
[ "func", "(", "s", "*", "Selection", ")", "Slice", "(", "start", ",", "end", "int", ")", "*", "Selection", "{", "if", "start", "<", "0", "{", "start", "+=", "len", "(", "s", ".", "Nodes", ")", "\n", "}", "\n", "if", "end", "<", "0", "{", "end"...
// Slice reduces the set of matched elements to a subset specified by a range // of indices.
[ "Slice", "reduces", "the", "set", "of", "matched", "elements", "to", "a", "subset", "specified", "by", "a", "range", "of", "indices", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L39-L47
134,219
henrylee2cn/pholcus
common/goquery/array.go
Get
func (s *Selection) Get(index int) *html.Node { if index < 0 { index += len(s.Nodes) // Negative index gets from the end } return s.Nodes[index] }
go
func (s *Selection) Get(index int) *html.Node { if index < 0 { index += len(s.Nodes) // Negative index gets from the end } return s.Nodes[index] }
[ "func", "(", "s", "*", "Selection", ")", "Get", "(", "index", "int", ")", "*", "html", ".", "Node", "{", "if", "index", "<", "0", "{", "index", "+=", "len", "(", "s", ".", "Nodes", ")", "// Negative index gets from the end", "\n", "}", "\n", "return"...
// Get retrieves the underlying node at the specified index. // Get without parameter is not implemented, since the node array is available // on the Selection object.
[ "Get", "retrieves", "the", "underlying", "node", "at", "the", "specified", "index", ".", "Get", "without", "parameter", "is", "not", "implemented", "since", "the", "node", "array", "is", "available", "on", "the", "Selection", "object", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L52-L57
134,220
henrylee2cn/pholcus
common/goquery/array.go
Index
func (s *Selection) Index() int { if len(s.Nodes) > 0 { return newSingleSelection(s.Nodes[0], s.document).PrevAll().Length() } return -1 }
go
func (s *Selection) Index() int { if len(s.Nodes) > 0 { return newSingleSelection(s.Nodes[0], s.document).PrevAll().Length() } return -1 }
[ "func", "(", "s", "*", "Selection", ")", "Index", "(", ")", "int", "{", "if", "len", "(", "s", ".", "Nodes", ")", ">", "0", "{", "return", "newSingleSelection", "(", "s", ".", "Nodes", "[", "0", "]", ",", "s", ".", "document", ")", ".", "PrevAl...
// Index returns the position of the first element within the Selection object // relative to its sibling elements.
[ "Index", "returns", "the", "position", "of", "the", "first", "element", "within", "the", "Selection", "object", "relative", "to", "its", "sibling", "elements", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L61-L66
134,221
henrylee2cn/pholcus
common/goquery/array.go
IndexSelector
func (s *Selection) IndexSelector(selector string) int { if len(s.Nodes) > 0 { sel := s.document.Find(selector) return indexInSlice(sel.Nodes, s.Nodes[0]) } return -1 }
go
func (s *Selection) IndexSelector(selector string) int { if len(s.Nodes) > 0 { sel := s.document.Find(selector) return indexInSlice(sel.Nodes, s.Nodes[0]) } return -1 }
[ "func", "(", "s", "*", "Selection", ")", "IndexSelector", "(", "selector", "string", ")", "int", "{", "if", "len", "(", "s", ".", "Nodes", ")", ">", "0", "{", "sel", ":=", "s", ".", "document", ".", "Find", "(", "selector", ")", "\n", "return", "...
// IndexSelector returns the position of the first element within the // Selection object relative to the elements matched by the selector, or -1 if // not found.
[ "IndexSelector", "returns", "the", "position", "of", "the", "first", "element", "within", "the", "Selection", "object", "relative", "to", "the", "elements", "matched", "by", "the", "selector", "or", "-", "1", "if", "not", "found", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L71-L77
134,222
henrylee2cn/pholcus
common/goquery/array.go
IndexMatcher
func (s *Selection) IndexMatcher(m Matcher) int { if len(s.Nodes) > 0 { sel := s.document.FindMatcher(m) return indexInSlice(sel.Nodes, s.Nodes[0]) } return -1 }
go
func (s *Selection) IndexMatcher(m Matcher) int { if len(s.Nodes) > 0 { sel := s.document.FindMatcher(m) return indexInSlice(sel.Nodes, s.Nodes[0]) } return -1 }
[ "func", "(", "s", "*", "Selection", ")", "IndexMatcher", "(", "m", "Matcher", ")", "int", "{", "if", "len", "(", "s", ".", "Nodes", ")", ">", "0", "{", "sel", ":=", "s", ".", "document", ".", "FindMatcher", "(", "m", ")", "\n", "return", "indexIn...
// IndexMatcher returns the position of the first element within the // Selection object relative to the elements matched by the matcher, or -1 if // not found.
[ "IndexMatcher", "returns", "the", "position", "of", "the", "first", "element", "within", "the", "Selection", "object", "relative", "to", "the", "elements", "matched", "by", "the", "matcher", "or", "-", "1", "if", "not", "found", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L82-L88
134,223
henrylee2cn/pholcus
common/goquery/array.go
IndexOfNode
func (s *Selection) IndexOfNode(node *html.Node) int { return indexInSlice(s.Nodes, node) }
go
func (s *Selection) IndexOfNode(node *html.Node) int { return indexInSlice(s.Nodes, node) }
[ "func", "(", "s", "*", "Selection", ")", "IndexOfNode", "(", "node", "*", "html", ".", "Node", ")", "int", "{", "return", "indexInSlice", "(", "s", ".", "Nodes", ",", "node", ")", "\n", "}" ]
// IndexOfNode returns the position of the specified node within the Selection // object, or -1 if not found.
[ "IndexOfNode", "returns", "the", "position", "of", "the", "specified", "node", "within", "the", "Selection", "object", "or", "-", "1", "if", "not", "found", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L92-L94
134,224
henrylee2cn/pholcus
common/goquery/array.go
IndexOfSelection
func (s *Selection) IndexOfSelection(sel *Selection) int { if sel != nil && len(sel.Nodes) > 0 { return indexInSlice(s.Nodes, sel.Nodes[0]) } return -1 }
go
func (s *Selection) IndexOfSelection(sel *Selection) int { if sel != nil && len(sel.Nodes) > 0 { return indexInSlice(s.Nodes, sel.Nodes[0]) } return -1 }
[ "func", "(", "s", "*", "Selection", ")", "IndexOfSelection", "(", "sel", "*", "Selection", ")", "int", "{", "if", "sel", "!=", "nil", "&&", "len", "(", "sel", ".", "Nodes", ")", ">", "0", "{", "return", "indexInSlice", "(", "s", ".", "Nodes", ",", ...
// IndexOfSelection returns the position of the first node in the specified // Selection object within this Selection object, or -1 if not found.
[ "IndexOfSelection", "returns", "the", "position", "of", "the", "first", "node", "in", "the", "specified", "Selection", "object", "within", "this", "Selection", "object", "or", "-", "1", "if", "not", "found", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/goquery/array.go#L98-L103
134,225
henrylee2cn/pholcus
common/config/config.go
Register
func Register(name string, adapter Config) { if adapter == nil { panic("config: Register adapter is nil") } if _, ok := adapters[name]; ok { panic("config: Register called twice for adapter " + name) } adapters[name] = adapter }
go
func Register(name string, adapter Config) { if adapter == nil { panic("config: Register adapter is nil") } if _, ok := adapters[name]; ok { panic("config: Register called twice for adapter " + name) } adapters[name] = adapter }
[ "func", "Register", "(", "name", "string", ",", "adapter", "Config", ")", "{", "if", "adapter", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "_", ",", "ok", ":=", "adapters", "[", "name", "]", ";", "ok", "{", "panic", ...
// Register makes a config adapter available by the adapter name. // If Register is called twice with the same name or if driver is nil, // it panics.
[ "Register", "makes", "a", "config", "adapter", "available", "by", "the", "adapter", "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/config/config.go#L80-L88
134,226
henrylee2cn/pholcus
common/config/config.go
ParseBool
func ParseBool(val interface{}) (value bool, err error) { if val != nil { switch v := val.(type) { case bool: return v, nil case string: switch v { case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "Y", "y", "ON", "on", "On": return true, nil case "0", "f", "F", "false", "FALSE", "...
go
func ParseBool(val interface{}) (value bool, err error) { if val != nil { switch v := val.(type) { case bool: return v, nil case string: switch v { case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "Y", "y", "ON", "on", "On": return true, nil case "0", "f", "F", "false", "FALSE", "...
[ "func", "ParseBool", "(", "val", "interface", "{", "}", ")", "(", "value", "bool", ",", "err", "error", ")", "{", "if", "val", "!=", "nil", "{", "switch", "v", ":=", "val", ".", "(", "type", ")", "{", "case", "bool", ":", "return", "v", ",", "n...
// ParseBool returns the boolean value represented by the string. // // It accepts 1, 1.0, t, T, TRUE, true, True, YES, yes, Yes,Y, y, ON, on, On, // 0, 0.0, f, F, FALSE, false, False, NO, no, No, N,n, OFF, off, Off. // Any other value returns an error.
[ "ParseBool", "returns", "the", "boolean", "value", "represented", "by", "the", "string", ".", "It", "accepts", "1", "1", ".", "0", "t", "T", "TRUE", "true", "True", "YES", "yes", "Yes", "Y", "y", "ON", "on", "On", "0", "0", ".", "0", "f", "F", "F...
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/config/config.go#L115-L144
134,227
henrylee2cn/pholcus
common/websocket/server.go
ServeHTTP
func (h Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { s := Server{Handler: h, Handshake: checkOrigin} s.serveWebSocket(w, req) }
go
func (h Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { s := Server{Handler: h, Handshake: checkOrigin} s.serveWebSocket(w, req) }
[ "func", "(", "h", "Handler", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "s", ":=", "Server", "{", "Handler", ":", "h", ",", "Handshake", ":", "checkOrigin", "}", "\n", "s", ".", "se...
// ServeHTTP implements the http.Handler interface for a WebSocket
[ "ServeHTTP", "implements", "the", "http", ".", "Handler", "interface", "for", "a", "WebSocket" ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/websocket/server.go#L111-L114
134,228
henrylee2cn/pholcus
common/mahonia/kuten.go
Reverse
func (t *kutenTable) Reverse() { t.once.Do(func() { t.FromUnicode = make([][2]byte, 65536) for ku := range t.Data { for ten, unicode := range t.Data[ku] { t.FromUnicode[unicode] = [2]byte{byte(ku), byte(ten)} } } }) }
go
func (t *kutenTable) Reverse() { t.once.Do(func() { t.FromUnicode = make([][2]byte, 65536) for ku := range t.Data { for ten, unicode := range t.Data[ku] { t.FromUnicode[unicode] = [2]byte{byte(ku), byte(ten)} } } }) }
[ "func", "(", "t", "*", "kutenTable", ")", "Reverse", "(", ")", "{", "t", ".", "once", ".", "Do", "(", "func", "(", ")", "{", "t", ".", "FromUnicode", "=", "make", "(", "[", "]", "[", "2", "]", "byte", ",", "65536", ")", "\n", "for", "ku", "...
// Reverse generates FromUnicode.
[ "Reverse", "generates", "FromUnicode", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/kuten.go#L25-L34
134,229
henrylee2cn/pholcus
common/mahonia/kuten.go
DecodeLow
func (t *kutenTable) DecodeLow(p []byte) (c rune, size int, status Status) { if len(p) < 2 { return 0, 0, NO_ROOM } ku := p[0] - 0x21 ten := p[1] - 0x21 if ku > 93 || ten > 93 { return utf8.RuneError, 1, INVALID_CHAR } u := t.Data[ku][ten] if u == 0 { return utf8.RuneError, 1, INVALID_CHAR } return rune...
go
func (t *kutenTable) DecodeLow(p []byte) (c rune, size int, status Status) { if len(p) < 2 { return 0, 0, NO_ROOM } ku := p[0] - 0x21 ten := p[1] - 0x21 if ku > 93 || ten > 93 { return utf8.RuneError, 1, INVALID_CHAR } u := t.Data[ku][ten] if u == 0 { return utf8.RuneError, 1, INVALID_CHAR } return rune...
[ "func", "(", "t", "*", "kutenTable", ")", "DecodeLow", "(", "p", "[", "]", "byte", ")", "(", "c", "rune", ",", "size", "int", ",", "status", "Status", ")", "{", "if", "len", "(", "p", ")", "<", "2", "{", "return", "0", ",", "0", ",", "NO_ROOM...
// DecodeLow decodes a character from an encoding that does not have the high // bit set.
[ "DecodeLow", "decodes", "a", "character", "from", "an", "encoding", "that", "does", "not", "have", "the", "high", "bit", "set", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/kuten.go#L38-L52
134,230
henrylee2cn/pholcus
common/mahonia/kuten.go
EncodeHigh
func (t *kutenTable) EncodeHigh(p []byte, c rune) (size int, status Status) { if len(p) < 2 { return 0, NO_ROOM } if c > 0xffff { p[0] = '?' return 1, INVALID_CHAR } kuten := t.FromUnicode[c] if kuten == [2]byte{0, 0} && c != rune(t.Data[0][0]) { p[0] = '?' return 1, INVALID_CHAR } p[0] = kuten[0] + 0...
go
func (t *kutenTable) EncodeHigh(p []byte, c rune) (size int, status Status) { if len(p) < 2 { return 0, NO_ROOM } if c > 0xffff { p[0] = '?' return 1, INVALID_CHAR } kuten := t.FromUnicode[c] if kuten == [2]byte{0, 0} && c != rune(t.Data[0][0]) { p[0] = '?' return 1, INVALID_CHAR } p[0] = kuten[0] + 0...
[ "func", "(", "t", "*", "kutenTable", ")", "EncodeHigh", "(", "p", "[", "]", "byte", ",", "c", "rune", ")", "(", "size", "int", ",", "status", "Status", ")", "{", "if", "len", "(", "p", ")", "<", "2", "{", "return", "0", ",", "NO_ROOM", "\n", ...
// EncodeHigh encodes a character in an encoding that has the high bit set.
[ "EncodeHigh", "encodes", "a", "character", "in", "an", "encoding", "that", "has", "the", "high", "bit", "set", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/kuten.go#L72-L88
134,231
henrylee2cn/pholcus
common/mahonia/reader.go
NewReader
func (d Decoder) NewReader(rd io.Reader) *Reader { b := new(Reader) b.buf = make([]byte, defaultBufSize) b.rd = rd b.decode = d return b }
go
func (d Decoder) NewReader(rd io.Reader) *Reader { b := new(Reader) b.buf = make([]byte, defaultBufSize) b.rd = rd b.decode = d return b }
[ "func", "(", "d", "Decoder", ")", "NewReader", "(", "rd", "io", ".", "Reader", ")", "*", "Reader", "{", "b", ":=", "new", "(", "Reader", ")", "\n", "b", ".", "buf", "=", "make", "(", "[", "]", "byte", ",", "defaultBufSize", ")", "\n", "b", ".",...
// NewReader creates a new Reader that uses the receiver to decode text.
[ "NewReader", "creates", "a", "new", "Reader", "that", "uses", "the", "receiver", "to", "decode", "text", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/reader.go#L29-L35
134,232
henrylee2cn/pholcus
common/mahonia/reader.go
ReadRune
func (b *Reader) ReadRune() (c rune, size int, err error) { read: c, size, status := b.decode(b.buf[b.r:b.w]) if status == NO_ROOM && b.err == nil { b.fill() goto read } if status == STATE_ONLY { b.r += size goto read } if b.r == b.w { return 0, 0, b.err } if status == NO_ROOM { c = 0xfffd siz...
go
func (b *Reader) ReadRune() (c rune, size int, err error) { read: c, size, status := b.decode(b.buf[b.r:b.w]) if status == NO_ROOM && b.err == nil { b.fill() goto read } if status == STATE_ONLY { b.r += size goto read } if b.r == b.w { return 0, 0, b.err } if status == NO_ROOM { c = 0xfffd siz...
[ "func", "(", "b", "*", "Reader", ")", "ReadRune", "(", ")", "(", "c", "rune", ",", "size", "int", ",", "err", "error", ")", "{", "read", ":", "c", ",", "size", ",", "status", ":=", "b", ".", "decode", "(", "b", ".", "buf", "[", "b", ".", "r...
// ReadRune reads a single Unicode character and returns the // rune and its size in bytes.
[ "ReadRune", "reads", "a", "single", "Unicode", "character", "and", "returns", "the", "rune", "and", "its", "size", "in", "bytes", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/reader.go#L125-L151
134,233
henrylee2cn/pholcus
common/mahonia/convert_string.go
ConvertString
func (e Encoder) ConvertString(s string) string { dest := make([]byte, len(s)+10) destPos := 0 for _, rune := range s { retry: size, status := e(dest[destPos:], rune) if status == NO_ROOM { newDest := make([]byte, len(dest)*2) copy(newDest, dest) dest = newDest goto retry } if status == STATE...
go
func (e Encoder) ConvertString(s string) string { dest := make([]byte, len(s)+10) destPos := 0 for _, rune := range s { retry: size, status := e(dest[destPos:], rune) if status == NO_ROOM { newDest := make([]byte, len(dest)*2) copy(newDest, dest) dest = newDest goto retry } if status == STATE...
[ "func", "(", "e", "Encoder", ")", "ConvertString", "(", "s", "string", ")", "string", "{", "dest", ":=", "make", "(", "[", "]", "byte", ",", "len", "(", "s", ")", "+", "10", ")", "\n", "destPos", ":=", "0", "\n\n", "for", "_", ",", "rune", ":="...
// ConvertString converts a string from UTF-8 to e's encoding.
[ "ConvertString", "converts", "a", "string", "from", "UTF", "-", "8", "to", "e", "s", "encoding", "." ]
5e73d3ff534090b22e8dde1950abe5d0fce5f746
https://github.com/henrylee2cn/pholcus/blob/5e73d3ff534090b22e8dde1950abe5d0fce5f746/common/mahonia/convert_string.go#L8-L32
134,234
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
134,235
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
134,236
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
134,237
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
134,238
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
134,239
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
134,240
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
134,241
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
134,242
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
134,243
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
134,244
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
134,245
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
134,246
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
134,247
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
134,248
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
134,249
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
134,250
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
134,251
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
134,252
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
134,253
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
134,254
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
134,255
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
134,256
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
134,257
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
134,258
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
134,259
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
134,260
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
134,261
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
134,262
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
134,263
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
134,264
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
134,265
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
134,266
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
134,267
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
134,268
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
134,269
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
134,270
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
134,271
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
134,272
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
134,273
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
134,274
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
134,275
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
134,276
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
134,277
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
134,278
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
134,279
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
134,280
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
134,281
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
134,282
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
134,283
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
134,284
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
134,285
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
134,286
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
134,287
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
134,288
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
134,289
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
134,290
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
134,291
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
134,292
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
134,293
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
134,294
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
134,295
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
134,296
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
134,297
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
134,298
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
134,299
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