String returns string representation of ObjectID that is suitable for displaying in the UI.
()
| 61 | |
| 62 | // String returns string representation of ObjectID that is suitable for displaying in the UI. |
| 63 | func (i ID) String() string { |
| 64 | var ( |
| 65 | indirectPrefix string |
| 66 | compressionPrefix string |
| 67 | ) |
| 68 | |
| 69 | switch i.indirection { |
| 70 | case 0: |
| 71 | // no prefix |
| 72 | case 1: |
| 73 | indirectPrefix = "I" |
| 74 | default: |
| 75 | indirectPrefix = strings.Repeat("I", int(i.indirection)) |
| 76 | } |
| 77 | |
| 78 | if i.compression { |
| 79 | compressionPrefix = "Z" |
| 80 | } |
| 81 | |
| 82 | return indirectPrefix + compressionPrefix + i.cid.String() |
| 83 | } |
| 84 | |
| 85 | // Append appends string representation of ObjectID that is suitable for displaying in the UI. |
| 86 | func (i ID) Append(out []byte) []byte { |