Skip to content

feat: export UUID and Int64 suffix length constants - #6

Merged
VojtechVitek merged 1 commit into
masterfrom
feat/export-suffix-lengths
Jun 17, 2026
Merged

feat: export UUID and Int64 suffix length constants#6
VojtechVitek merged 1 commit into
masterfrom
feat/export-suffix-lengths

Conversation

@klaidliadon

Copy link
Copy Markdown
Collaborator

Exposes the two id-encoding suffix widths as exported constants (UUIDSuffixLen = 26, Int64SuffixLen = 13) so callers that length-classify a typeid string don't hardcode the numbers.


The concrete motivation: a project-scoped API key encodes its project as a fixed-width segment inside a composite prefix (pk_live_<project-13>_<key-26>), and the classifier peels it off by length. Today that means a local const = 13 mirroring typeid's internal int64SuffixLen. Referencing typeid.Int64SuffixLen makes the coupling explicit and removes the magic number.

Pure rename of the existing unexported consts (uuidSuffixLen/int64SuffixLenUUIDSuffixLen/Int64SuffixLen) plus a doc comment. No behavior change; the values are stable wire-format invariants (a UUID is 128 bits, an Int64 is 63 bits).

Test plan

go build ./...      # clean
go test ./...       # ok
go vet ./...        # no issues

Rename uuidSuffixLen/int64SuffixLen to UUIDSuffixLen/Int64SuffixLen so callers
that length-classify a typeid string (e.g. peeling a fixed-width segment off a
composite prefix) can reference the widths instead of hardcoding 26/13. The
values are stable wire-format invariants; this is a pure API addition with no
behavior change.
@klaidliadon
klaidliadon requested a review from VojtechVitek June 17, 2026 10:14
@VojtechVitek
VojtechVitek merged commit 111a4d5 into master Jun 17, 2026
4 checks passed
@VojtechVitek
VojtechVitek deleted the feat/export-suffix-lengths branch June 17, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants