Documentation ¶
Index ¶
- func AddNode4SubUrl(ctx context.Context, subUrl string) error
- func AddNodes2Disk(subUrl string, body string) error
- func GetNewClient(...) http.Client
- func LoadProxyList(ctx context.Context, subUrl string, cacheTimeout time.Duration) (proxyList proxy.ProxyList)
- type CheckDetail
- type CheckResult
- type CheckResultList
- func (ss CheckResultList) All(fn func(value *CheckResult) bool) bool
- func (ss CheckResultList) Any(fn func(value *CheckResult) bool) bool
- func (ss CheckResultList) Append(elements ...*CheckResult) CheckResultList
- func (ss CheckResultList) Bottom(n int) (top CheckResultList)
- func (ss CheckResultList) Chunk(chunkSize int, callback func(chunk CheckResultList) (stopped bool))
- func (ss CheckResultList) Contains(lookingFor *CheckResult) bool
- func (ss CheckResultList) Diff(against CheckResultList) (added, removed CheckResultList)
- func (ss CheckResultList) DropTop(n int) (drop CheckResultList)
- func (ss CheckResultList) Each(fn func(*CheckResult)) CheckResultList
- func (ss CheckResultList) Equals(rhs CheckResultList) bool
- func (ss CheckResultList) Extend(slices ...CheckResultList) (ss2 CheckResultList)
- func (ss CheckResultList) Filter(condition func(*CheckResult) bool) (ss2 CheckResultList)
- func (ss CheckResultList) FilterNot(condition func(*CheckResult) bool) (ss2 CheckResultList)
- func (ss CheckResultList) FindFirstUsing(fn func(value *CheckResult) bool) int
- func (ss CheckResultList) First() *CheckResult
- func (ss CheckResultList) FirstOr(defaultValue *CheckResult) *CheckResult
- func (ss CheckResultList) Float64s() pie.Float64s
- func (p CheckResultList) GetAliveNodes() CheckResultList
- func (ss CheckResultList) Insert(index int, values ...*CheckResult) CheckResultList
- func (ss CheckResultList) Ints() pie.Ints
- func (ss CheckResultList) JSONBytes() []byte
- func (ss CheckResultList) JSONBytesIndent(prefix, indent string) []byte
- func (ss CheckResultList) JSONString() string
- func (ss CheckResultList) JSONStringIndent(prefix, indent string) string
- func (ss CheckResultList) Join(glue string) (s string)
- func (ss CheckResultList) Last() *CheckResult
- func (ss CheckResultList) LastOr(defaultValue *CheckResult) *CheckResult
- func (ss CheckResultList) Len() int
- func (ss CheckResultList) Map(fn func(*CheckResult) *CheckResult) (ss2 CheckResultList)
- func (ss CheckResultList) Mode() CheckResultList
- func (ss *CheckResultList) Pop() (popped **CheckResult)
- func (ss CheckResultList) Random(source rand.Source) *CheckResult
- func (ss CheckResultList) Reverse() CheckResultList
- func (ss CheckResultList) Send(ctx context.Context, ch chan<- *CheckResult) CheckResultList
- func (ss CheckResultList) SequenceUsing(creator func(int) *CheckResult, params ...int) CheckResultList
- func (ss CheckResultList) Shift() (*CheckResult, CheckResultList)
- func (ss CheckResultList) Shuffle(source rand.Source) CheckResultList
- func (ss CheckResultList) SortStableUsing(less func(a, b *CheckResult) bool) CheckResultList
- func (ss CheckResultList) SortUsing(less func(a, b *CheckResult) bool) CheckResultList
- func (ss CheckResultList) Strings() pie.Strings
- func (ss CheckResultList) StringsUsing(transform func(*CheckResult) string) pie.Strings
- func (ss CheckResultList) SubSlice(start int, end int) (subSlice CheckResultList)
- func (ss CheckResultList) Top(n int) (top CheckResultList)
- func (ss CheckResultList) Unshift(elements ...*CheckResult) (unshift CheckResultList)
- type CheckType
- type NodeDetail
- type NodeDetailList
- func (ss NodeDetailList) All(fn func(value *NodeDetail) bool) bool
- func (ss NodeDetailList) Any(fn func(value *NodeDetail) bool) bool
- func (ss NodeDetailList) Append(elements ...*NodeDetail) NodeDetailList
- func (ss NodeDetailList) Bottom(n int) (top NodeDetailList)
- func (ss NodeDetailList) Chunk(chunkSize int, callback func(chunk NodeDetailList) (stopped bool))
- func (ss NodeDetailList) Contains(lookingFor *NodeDetail) bool
- func (ss NodeDetailList) Diff(against NodeDetailList) (added, removed NodeDetailList)
- func (ss NodeDetailList) DropTop(n int) (drop NodeDetailList)
- func (ss NodeDetailList) Each(fn func(*NodeDetail)) NodeDetailList
- func (ss NodeDetailList) Equals(rhs NodeDetailList) bool
- func (ss NodeDetailList) Extend(slices ...NodeDetailList) (ss2 NodeDetailList)
- func (ss NodeDetailList) Filter(condition func(*NodeDetail) bool) (ss2 NodeDetailList)
- func (ss NodeDetailList) FilterNot(condition func(*NodeDetail) bool) (ss2 NodeDetailList)
- func (ss NodeDetailList) FindFirstUsing(fn func(value *NodeDetail) bool) int
- func (ss NodeDetailList) First() *NodeDetail
- func (ss NodeDetailList) FirstOr(defaultValue *NodeDetail) *NodeDetail
- func (ss NodeDetailList) Float64s() pie.Float64s
- func (ss NodeDetailList) Insert(index int, values ...*NodeDetail) NodeDetailList
- func (ss NodeDetailList) Ints() pie.Ints
- func (ss NodeDetailList) JSONBytes() []byte
- func (ss NodeDetailList) JSONBytesIndent(prefix, indent string) []byte
- func (ss NodeDetailList) JSONString() string
- func (ss NodeDetailList) JSONStringIndent(prefix, indent string) string
- func (ss NodeDetailList) Join(glue string) (s string)
- func (ss NodeDetailList) Last() *NodeDetail
- func (ss NodeDetailList) LastOr(defaultValue *NodeDetail) *NodeDetail
- func (ss NodeDetailList) Len() int
- func (ss NodeDetailList) Map(fn func(*NodeDetail) *NodeDetail) (ss2 NodeDetailList)
- func (ss NodeDetailList) Mode() NodeDetailList
- func (ss *NodeDetailList) Pop() (popped **NodeDetail)
- func (ss NodeDetailList) Random(source rand.Source) *NodeDetail
- func (ss NodeDetailList) Reverse() NodeDetailList
- func (ss NodeDetailList) Send(ctx context.Context, ch chan<- *NodeDetail) NodeDetailList
- func (ss NodeDetailList) SequenceUsing(creator func(int) *NodeDetail, params ...int) NodeDetailList
- func (ss NodeDetailList) Shift() (*NodeDetail, NodeDetailList)
- func (ss NodeDetailList) Shuffle(source rand.Source) NodeDetailList
- func (ss NodeDetailList) SortStableUsing(less func(a, b *NodeDetail) bool) NodeDetailList
- func (ss NodeDetailList) SortUsing(less func(a, b *NodeDetail) bool) NodeDetailList
- func (ss NodeDetailList) Strings() pie.Strings
- func (ss NodeDetailList) StringsUsing(transform func(*NodeDetail) string) pie.Strings
- func (ss NodeDetailList) SubSlice(start int, end int) (subSlice NodeDetailList)
- func (ss NodeDetailList) Top(n int) (top NodeDetailList)
- func (ss NodeDetailList) Unshift(elements ...*NodeDetail) (unshift NodeDetailList)
- type Site
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddNodes2Disk ¶
func GetNewClient ¶
Types ¶
type CheckDetail ¶
type CheckResult ¶
type CheckResult struct { Node proxy.Proxy Body []byte Headers http.Header Speed string SpeedNum float64 RequestDelay time.Duration DownloadDelay time.Duration StatusCode int Status string Delay time.Duration Alive bool }
func CheckOnce4Visit ¶
func CheckOnce4Visit(n proxy.Proxy) *CheckResult
type CheckResultList ¶
type CheckResultList []*CheckResult
func CheckProxyList4Visit ¶
func CheckProxyList4Visit(proxyList proxy.ProxyList, pool *gpool.SubPool) (resultList CheckResultList)
func (CheckResultList) All ¶
func (ss CheckResultList) All(fn func(value *CheckResult) bool) bool
All will return true if all callbacks return true. It follows the same logic as the all() function in Python.
If the list is empty then true is always returned.
func (CheckResultList) Any ¶
func (ss CheckResultList) Any(fn func(value *CheckResult) bool) bool
Any will return true if any callbacks return true. It follows the same logic as the any() function in Python.
If the list is empty then false is always returned.
func (CheckResultList) Append ¶
func (ss CheckResultList) Append(elements ...*CheckResult) CheckResultList
Append will return a new slice with the elements appended to the end.
It is acceptable to provide zero arguments.
func (CheckResultList) Bottom ¶
func (ss CheckResultList) Bottom(n int) (top CheckResultList)
Bottom will return n elements from bottom
that means that elements is taken from the end of the slice for this [1,2,3] slice with n == 2 will be returned [3,2] if the slice has less elements then n that'll return all elements if n < 0 it'll return empty slice.
func (CheckResultList) Chunk ¶
func (ss CheckResultList) Chunk(chunkSize int, callback func(chunk CheckResultList) (stopped bool))
Split slice to chunks
func (CheckResultList) Contains ¶
func (ss CheckResultList) Contains(lookingFor *CheckResult) bool
Contains returns true if the element exists in the slice.
When using slices of pointers it will only compare by address, not value.
func (CheckResultList) Diff ¶
func (ss CheckResultList) Diff(against CheckResultList) (added, removed CheckResultList)
Diff returns the elements that needs to be added or removed from the first slice to have the same elements in the second slice.
The order of elements is not taken into consideration, so the slices are treated sets that allow duplicate items.
The added and removed returned may be blank respectively, or contain upto as many elements that exists in the largest slice.
func (CheckResultList) DropTop ¶
func (ss CheckResultList) DropTop(n int) (drop CheckResultList)
DropTop will return the rest slice after dropping the top n elements if the slice has less elements then n that'll return empty slice if n < 0 it'll return empty slice.
func (CheckResultList) Each ¶
func (ss CheckResultList) Each(fn func(*CheckResult)) CheckResultList
Each is more condensed version of Transform that allows an action to happen on each elements and pass the original slice on.
cars.Each(func (car *Car) { fmt.Printf("Car color is: %s\n", car.Color) })
Pie will not ensure immutability on items passed in so they can be manipulated, if you choose to do it this way, for example:
// Set all car colors to Red. cars.Each(func (car *Car) { car.Color = "Red" })
func (CheckResultList) Equals ¶
func (ss CheckResultList) Equals(rhs CheckResultList) bool
Equals compare elements from the start to the end,
if they are the same is considered the slices are equal if all elements are the same is considered the slices are equal if each slice == nil is considered that they're equal
if element realizes Equals interface it uses that method, in other way uses default compare
func (CheckResultList) Extend ¶
func (ss CheckResultList) Extend(slices ...CheckResultList) (ss2 CheckResultList)
Extend will return a new slice with the slices of elements appended to the end.
It is acceptable to provide zero arguments.
func (CheckResultList) Filter ¶
func (ss CheckResultList) Filter(condition func(*CheckResult) bool) (ss2 CheckResultList)
Filter will return a new slice containing only the elements that return true from the condition. The returned slice may contain zero elements (nil).
FilterNot works in the opposite way of Filter.
func (CheckResultList) FilterNot ¶
func (ss CheckResultList) FilterNot(condition func(*CheckResult) bool) (ss2 CheckResultList)
FilterNot works the same as Filter, with a negated condition. That is, it will return a new slice only containing the elements that returned false from the condition. The returned slice may contain zero elements (nil).
func (CheckResultList) FindFirstUsing ¶
func (ss CheckResultList) FindFirstUsing(fn func(value *CheckResult) bool) int
FindFirstUsing will return the index of the first element when the callback returns true or -1 if no element is found. It follows the same logic as the findIndex() function in Javascript.
If the list is empty then -1 is always returned.
func (CheckResultList) First ¶
func (ss CheckResultList) First() *CheckResult
First returns the first element, or zero. Also see FirstOr().
func (CheckResultList) FirstOr ¶
func (ss CheckResultList) FirstOr(defaultValue *CheckResult) *CheckResult
FirstOr returns the first element or a default value if there are no elements.
func (CheckResultList) Float64s ¶
func (ss CheckResultList) Float64s() pie.Float64s
Float64s transforms each element to a float64.
func (CheckResultList) GetAliveNodes ¶
func (p CheckResultList) GetAliveNodes() CheckResultList
func (CheckResultList) Insert ¶
func (ss CheckResultList) Insert(index int, values ...*CheckResult) CheckResultList
Insert a value at an index
func (CheckResultList) Ints ¶
func (ss CheckResultList) Ints() pie.Ints
Ints transforms each element to an integer.
func (CheckResultList) JSONBytes ¶
func (ss CheckResultList) JSONBytes() []byte
JSONBytes returns the JSON encoded array as bytes.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array.
func (CheckResultList) JSONBytesIndent ¶
func (ss CheckResultList) JSONBytesIndent(prefix, indent string) []byte
JSONBytesIndent returns the JSON encoded array as bytes with indent applied.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array. See json.MarshalIndent for details.
func (CheckResultList) JSONString ¶
func (ss CheckResultList) JSONString() string
JSONString returns the JSON encoded array as a string.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array.
func (CheckResultList) JSONStringIndent ¶
func (ss CheckResultList) JSONStringIndent(prefix, indent string) string
JSONStringIndent returns the JSON encoded array as a string with indent applied.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array. See json.MarshalIndent for details.
func (CheckResultList) Join ¶
func (ss CheckResultList) Join(glue string) (s string)
Join returns a string from joining each of the elements.
func (CheckResultList) Last ¶
func (ss CheckResultList) Last() *CheckResult
Last returns the last element, or zero. Also see LastOr().
func (CheckResultList) LastOr ¶
func (ss CheckResultList) LastOr(defaultValue *CheckResult) *CheckResult
LastOr returns the last element or a default value if there are no elements.
func (CheckResultList) Len ¶
func (ss CheckResultList) Len() int
Len returns the number of elements.
func (CheckResultList) Map ¶
func (ss CheckResultList) Map(fn func(*CheckResult) *CheckResult) (ss2 CheckResultList)
Map will return a new slice where each element has been mapped (transformed). The number of elements returned will always be the same as the input.
Be careful when using this with slices of pointers. If you modify the input value it will affect the original slice. Be sure to return a new allocated object or deep copy the existing one.
func (CheckResultList) Mode ¶
func (ss CheckResultList) Mode() CheckResultList
Mode returns a new slice containing the most frequently occuring values.
The number of items returned may be the same as the input or less. It will never return zero items unless the input slice has zero items.
func (*CheckResultList) Pop ¶
func (ss *CheckResultList) Pop() (popped **CheckResult)
Pop the first element of the slice
Usage Example:
type knownGreetings []string greetings := knownGreetings{"ciao", "hello", "hola"} for greeting := greetings.Pop(); greeting != nil; greeting = greetings.Pop() { fmt.Println(*greeting) }
func (CheckResultList) Random ¶
func (ss CheckResultList) Random(source rand.Source) *CheckResult
Random returns a random element by your rand.Source, or zero
func (CheckResultList) Reverse ¶
func (ss CheckResultList) Reverse() CheckResultList
Reverse returns a new copy of the slice with the elements ordered in reverse. This is useful when combined with Sort to get a descending sort order:
ss.Sort().Reverse()
func (CheckResultList) Send ¶
func (ss CheckResultList) Send(ctx context.Context, ch chan<- *CheckResult) CheckResultList
Send sends elements to channel in normal act it sends all elements but if func canceled it can be less
it locks execution of gorutine it doesn't close channel after work returns sended elements if len(this) != len(old) considered func was canceled
func (CheckResultList) SequenceUsing ¶
func (ss CheckResultList) SequenceUsing(creator func(int) *CheckResult, params ...int) CheckResultList
SequenceUsing generates slice in range using creator function
There are 3 variations to generate:
- [0, n).
- [min, max).
- [min, max) with step.
if len(params) == 1 considered that will be returned slice between 0 and n, where n is the first param, [0, n). if len(params) == 2 considered that will be returned slice between min and max, where min is the first param, max is the second, [min, max). if len(params) > 2 considered that will be returned slice between min and max with step, where min is the first param, max is the second, step is the third one, [min, max) with step, others params will be ignored
func (CheckResultList) Shift ¶
func (ss CheckResultList) Shift() (*CheckResult, CheckResultList)
Shift will return two values: the shifted value and the rest slice.
func (CheckResultList) Shuffle ¶
func (ss CheckResultList) Shuffle(source rand.Source) CheckResultList
Shuffle returns shuffled slice by your rand.Source
func (CheckResultList) SortStableUsing ¶
func (ss CheckResultList) SortStableUsing(less func(a, b *CheckResult) bool) CheckResultList
SortStableUsing works similar to sort.SliceStable. However, unlike sort.SliceStable the slice returned will be reallocated as to not modify the input slice.
func (CheckResultList) SortUsing ¶
func (ss CheckResultList) SortUsing(less func(a, b *CheckResult) bool) CheckResultList
SortUsing works similar to sort.Slice. However, unlike sort.Slice the slice returned will be reallocated as to not modify the input slice.
func (CheckResultList) Strings ¶
func (ss CheckResultList) Strings() pie.Strings
Strings transforms each element to a string.
If the element type implements fmt.Stringer it will be used. Otherwise it will fallback to the result of:
fmt.Sprintf("%v")
func (CheckResultList) StringsUsing ¶
func (ss CheckResultList) StringsUsing(transform func(*CheckResult) string) pie.Strings
StringsUsing transforms each element to a string.
func (CheckResultList) SubSlice ¶
func (ss CheckResultList) SubSlice(start int, end int) (subSlice CheckResultList)
SubSlice will return the subSlice from start to end(excluded)
Condition 1: If start < 0 or end < 0, nil is returned. Condition 2: If start >= end, nil is returned. Condition 3: Return all elements that exist in the range provided, if start or end is out of bounds, zero items will be placed.
func (CheckResultList) Top ¶
func (ss CheckResultList) Top(n int) (top CheckResultList)
Top will return n elements from head of the slice if the slice has less elements then n that'll return all elements if n < 0 it'll return empty slice.
func (CheckResultList) Unshift ¶
func (ss CheckResultList) Unshift(elements ...*CheckResult) (unshift CheckResultList)
Unshift adds one or more elements to the beginning of the slice and returns the new slice.
type NodeDetail ¶
type NodeDetail struct { Name string Node proxy.Proxy Alive bool WebDetail map[string]*CheckDetail Ip string Region string TimeZone string ISP string Operator string Lat float64 Lon float64 SpeedNum float64 // nf解锁地区 NetflixLocation string // nf自制解锁 NetflixSelfProduced bool TotalTraffic string UsedDuration time.Duration }
func CheckNode4Unlock ¶
func CheckNode4Unlock(n proxy.Proxy, baseInfo bool) (detail NodeDetail)
type NodeDetailList ¶
type NodeDetailList []*NodeDetail
func ProxyCheck4Unlock ¶
func (NodeDetailList) All ¶
func (ss NodeDetailList) All(fn func(value *NodeDetail) bool) bool
All will return true if all callbacks return true. It follows the same logic as the all() function in Python.
If the list is empty then true is always returned.
func (NodeDetailList) Any ¶
func (ss NodeDetailList) Any(fn func(value *NodeDetail) bool) bool
Any will return true if any callbacks return true. It follows the same logic as the any() function in Python.
If the list is empty then false is always returned.
func (NodeDetailList) Append ¶
func (ss NodeDetailList) Append(elements ...*NodeDetail) NodeDetailList
Append will return a new slice with the elements appended to the end.
It is acceptable to provide zero arguments.
func (NodeDetailList) Bottom ¶
func (ss NodeDetailList) Bottom(n int) (top NodeDetailList)
Bottom will return n elements from bottom
that means that elements is taken from the end of the slice for this [1,2,3] slice with n == 2 will be returned [3,2] if the slice has less elements then n that'll return all elements if n < 0 it'll return empty slice.
func (NodeDetailList) Chunk ¶
func (ss NodeDetailList) Chunk(chunkSize int, callback func(chunk NodeDetailList) (stopped bool))
Split slice to chunks
func (NodeDetailList) Contains ¶
func (ss NodeDetailList) Contains(lookingFor *NodeDetail) bool
Contains returns true if the element exists in the slice.
When using slices of pointers it will only compare by address, not value.
func (NodeDetailList) Diff ¶
func (ss NodeDetailList) Diff(against NodeDetailList) (added, removed NodeDetailList)
Diff returns the elements that needs to be added or removed from the first slice to have the same elements in the second slice.
The order of elements is not taken into consideration, so the slices are treated sets that allow duplicate items.
The added and removed returned may be blank respectively, or contain upto as many elements that exists in the largest slice.
func (NodeDetailList) DropTop ¶
func (ss NodeDetailList) DropTop(n int) (drop NodeDetailList)
DropTop will return the rest slice after dropping the top n elements if the slice has less elements then n that'll return empty slice if n < 0 it'll return empty slice.
func (NodeDetailList) Each ¶
func (ss NodeDetailList) Each(fn func(*NodeDetail)) NodeDetailList
Each is more condensed version of Transform that allows an action to happen on each elements and pass the original slice on.
cars.Each(func (car *Car) { fmt.Printf("Car color is: %s\n", car.Color) })
Pie will not ensure immutability on items passed in so they can be manipulated, if you choose to do it this way, for example:
// Set all car colors to Red. cars.Each(func (car *Car) { car.Color = "Red" })
func (NodeDetailList) Equals ¶
func (ss NodeDetailList) Equals(rhs NodeDetailList) bool
Equals compare elements from the start to the end,
if they are the same is considered the slices are equal if all elements are the same is considered the slices are equal if each slice == nil is considered that they're equal
if element realizes Equals interface it uses that method, in other way uses default compare
func (NodeDetailList) Extend ¶
func (ss NodeDetailList) Extend(slices ...NodeDetailList) (ss2 NodeDetailList)
Extend will return a new slice with the slices of elements appended to the end.
It is acceptable to provide zero arguments.
func (NodeDetailList) Filter ¶
func (ss NodeDetailList) Filter(condition func(*NodeDetail) bool) (ss2 NodeDetailList)
Filter will return a new slice containing only the elements that return true from the condition. The returned slice may contain zero elements (nil).
FilterNot works in the opposite way of Filter.
func (NodeDetailList) FilterNot ¶
func (ss NodeDetailList) FilterNot(condition func(*NodeDetail) bool) (ss2 NodeDetailList)
FilterNot works the same as Filter, with a negated condition. That is, it will return a new slice only containing the elements that returned false from the condition. The returned slice may contain zero elements (nil).
func (NodeDetailList) FindFirstUsing ¶
func (ss NodeDetailList) FindFirstUsing(fn func(value *NodeDetail) bool) int
FindFirstUsing will return the index of the first element when the callback returns true or -1 if no element is found. It follows the same logic as the findIndex() function in Javascript.
If the list is empty then -1 is always returned.
func (NodeDetailList) First ¶
func (ss NodeDetailList) First() *NodeDetail
First returns the first element, or zero. Also see FirstOr().
func (NodeDetailList) FirstOr ¶
func (ss NodeDetailList) FirstOr(defaultValue *NodeDetail) *NodeDetail
FirstOr returns the first element or a default value if there are no elements.
func (NodeDetailList) Float64s ¶
func (ss NodeDetailList) Float64s() pie.Float64s
Float64s transforms each element to a float64.
func (NodeDetailList) Insert ¶
func (ss NodeDetailList) Insert(index int, values ...*NodeDetail) NodeDetailList
Insert a value at an index
func (NodeDetailList) Ints ¶
func (ss NodeDetailList) Ints() pie.Ints
Ints transforms each element to an integer.
func (NodeDetailList) JSONBytes ¶
func (ss NodeDetailList) JSONBytes() []byte
JSONBytes returns the JSON encoded array as bytes.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array.
func (NodeDetailList) JSONBytesIndent ¶
func (ss NodeDetailList) JSONBytesIndent(prefix, indent string) []byte
JSONBytesIndent returns the JSON encoded array as bytes with indent applied.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array. See json.MarshalIndent for details.
func (NodeDetailList) JSONString ¶
func (ss NodeDetailList) JSONString() string
JSONString returns the JSON encoded array as a string.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array.
func (NodeDetailList) JSONStringIndent ¶
func (ss NodeDetailList) JSONStringIndent(prefix, indent string) string
JSONStringIndent returns the JSON encoded array as a string with indent applied.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array. See json.MarshalIndent for details.
func (NodeDetailList) Join ¶
func (ss NodeDetailList) Join(glue string) (s string)
Join returns a string from joining each of the elements.
func (NodeDetailList) Last ¶
func (ss NodeDetailList) Last() *NodeDetail
Last returns the last element, or zero. Also see LastOr().
func (NodeDetailList) LastOr ¶
func (ss NodeDetailList) LastOr(defaultValue *NodeDetail) *NodeDetail
LastOr returns the last element or a default value if there are no elements.
func (NodeDetailList) Map ¶
func (ss NodeDetailList) Map(fn func(*NodeDetail) *NodeDetail) (ss2 NodeDetailList)
Map will return a new slice where each element has been mapped (transformed). The number of elements returned will always be the same as the input.
Be careful when using this with slices of pointers. If you modify the input value it will affect the original slice. Be sure to return a new allocated object or deep copy the existing one.
func (NodeDetailList) Mode ¶
func (ss NodeDetailList) Mode() NodeDetailList
Mode returns a new slice containing the most frequently occuring values.
The number of items returned may be the same as the input or less. It will never return zero items unless the input slice has zero items.
func (*NodeDetailList) Pop ¶
func (ss *NodeDetailList) Pop() (popped **NodeDetail)
Pop the first element of the slice
Usage Example:
type knownGreetings []string greetings := knownGreetings{"ciao", "hello", "hola"} for greeting := greetings.Pop(); greeting != nil; greeting = greetings.Pop() { fmt.Println(*greeting) }
func (NodeDetailList) Random ¶
func (ss NodeDetailList) Random(source rand.Source) *NodeDetail
Random returns a random element by your rand.Source, or zero
func (NodeDetailList) Reverse ¶
func (ss NodeDetailList) Reverse() NodeDetailList
Reverse returns a new copy of the slice with the elements ordered in reverse. This is useful when combined with Sort to get a descending sort order:
ss.Sort().Reverse()
func (NodeDetailList) Send ¶
func (ss NodeDetailList) Send(ctx context.Context, ch chan<- *NodeDetail) NodeDetailList
Send sends elements to channel in normal act it sends all elements but if func canceled it can be less
it locks execution of gorutine it doesn't close channel after work returns sended elements if len(this) != len(old) considered func was canceled
func (NodeDetailList) SequenceUsing ¶
func (ss NodeDetailList) SequenceUsing(creator func(int) *NodeDetail, params ...int) NodeDetailList
SequenceUsing generates slice in range using creator function
There are 3 variations to generate:
- [0, n).
- [min, max).
- [min, max) with step.
if len(params) == 1 considered that will be returned slice between 0 and n, where n is the first param, [0, n). if len(params) == 2 considered that will be returned slice between min and max, where min is the first param, max is the second, [min, max). if len(params) > 2 considered that will be returned slice between min and max with step, where min is the first param, max is the second, step is the third one, [min, max) with step, others params will be ignored
func (NodeDetailList) Shift ¶
func (ss NodeDetailList) Shift() (*NodeDetail, NodeDetailList)
Shift will return two values: the shifted value and the rest slice.
func (NodeDetailList) Shuffle ¶
func (ss NodeDetailList) Shuffle(source rand.Source) NodeDetailList
Shuffle returns shuffled slice by your rand.Source
func (NodeDetailList) SortStableUsing ¶
func (ss NodeDetailList) SortStableUsing(less func(a, b *NodeDetail) bool) NodeDetailList
SortStableUsing works similar to sort.SliceStable. However, unlike sort.SliceStable the slice returned will be reallocated as to not modify the input slice.
func (NodeDetailList) SortUsing ¶
func (ss NodeDetailList) SortUsing(less func(a, b *NodeDetail) bool) NodeDetailList
SortUsing works similar to sort.Slice. However, unlike sort.Slice the slice returned will be reallocated as to not modify the input slice.
func (NodeDetailList) Strings ¶
func (ss NodeDetailList) Strings() pie.Strings
Strings transforms each element to a string.
If the element type implements fmt.Stringer it will be used. Otherwise it will fallback to the result of:
fmt.Sprintf("%v")
func (NodeDetailList) StringsUsing ¶
func (ss NodeDetailList) StringsUsing(transform func(*NodeDetail) string) pie.Strings
StringsUsing transforms each element to a string.
func (NodeDetailList) SubSlice ¶
func (ss NodeDetailList) SubSlice(start int, end int) (subSlice NodeDetailList)
SubSlice will return the subSlice from start to end(excluded)
Condition 1: If start < 0 or end < 0, nil is returned. Condition 2: If start >= end, nil is returned. Condition 3: Return all elements that exist in the range provided, if start or end is out of bounds, zero items will be placed.
func (NodeDetailList) Top ¶
func (ss NodeDetailList) Top(n int) (top NodeDetailList)
Top will return n elements from head of the slice if the slice has less elements then n that'll return all elements if n < 0 it'll return empty slice.
func (NodeDetailList) Unshift ¶
func (ss NodeDetailList) Unshift(elements ...*NodeDetail) (unshift NodeDetailList)
Unshift adds one or more elements to the beginning of the slice and returns the new slice.