MCPcopy Create free account
hub / github.com/brimdata/super / ParseID

Function ParseID

dbid/id.go:10–28  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

8)
9
10func ParseID(s string) (ksuid.KSUID, error) {
11 // Check if this is a cut-and-paste from BSUP, which encodes
12 // the 20-byte KSUID as a 40 character hex string with 0x prefix.
13 var id ksuid.KSUID
14 var err error
15 if len(s) == 42 && s[0:2] == "0x" {
16 var b []byte
17 b, err = hex.DecodeString(s[2:])
18 if err == nil {
19 id, err = ksuid.FromBytes(b)
20 }
21 } else {
22 id, err = ksuid.Parse(s)
23 }
24 if err != nil {
25 return ksuid.Nil, fmt.Errorf("invalid ID: %s", s)
26 }
27 return id, nil
28}
29
30func ParseIDs(ss []string) ([]ksuid.KSUID, error) {
31 ids := make([]ksuid.KSUID, 0, len(ss))

Callers 15

poolMethod · 0.92
deleteScanMethod · 0.92
semOpMethod · 0.92
handleBranchPostFunction · 0.92
PoolIDMethod · 0.92
TagFromPathMethod · 0.92
selectPoolFunction · 0.92
RunMethod · 0.92
RunMethod · 0.92
PoolIDMethod · 0.92
ResolveRevisionMethod · 0.92
GetCommitFunction · 0.92

Calls 1

ParseMethod · 0.80

Tested by 1

TestParseIDFunction · 0.68