MCPcopy
hub / github.com/openacid/slim / Get

Method Get

array/base.go:139–148  ·  view source on GitHub ↗

Get retrieves the value at "idx" and return it. If this array has a value at "idx" it returns the value and "true", otherwise it returns "nil" and "false". Since 0.2.0

(idx int32)

Source from the content-addressed store, hash-verified

137//
138// Since 0.2.0
139func (a *Base) Get(idx int32) (interface{}, bool) {
140
141 bs, ok := a.GetBytes(idx, a.EltEncoder.GetEncodedSize(nil))
142 if ok {
143 _, v := a.EltEncoder.Decode(bs)
144 return v, true
145 }
146
147 return nil, false
148}
149
150// GetBytes retrieves the raw data of value in []byte at "idx" and return it.
151//

Callers 2

TestBase_GetFunction · 0.95
BenchmarkBaseGetFunction · 0.95

Calls 3

GetBytesMethod · 0.95
GetEncodedSizeMethod · 0.65
DecodeMethod · 0.65

Tested by 2

TestBase_GetFunction · 0.76
BenchmarkBaseGetFunction · 0.76