1package boards23import (4 "strconv"5 "strings"67 "gno.land/p/nt/seqid/v0"8)910const paddedStringLen = 101112// ID defines a type for unique identifiers.13type ID uint641415// String returns the ID as a string.16func (id ID) String() string {17 return strconv.FormatUint(uint64(id), 10)18}1920// PaddedString returns the ID as a 10 character string padded with zeroes.21// This value can be used for indexing by ID.22func (id ID) PaddedString() string {23 s := id.String()24 return strings.Repeat("0", paddedStringLen-len(s)) + s25}2627// Key returns the ID as a string which can be used to index by ID.28func (id ID) Key() string {29 return seqid.ID(id).String()30}3132// IdentifierGenerator defines an interface for sequential unique identifier generators.33type IdentifierGenerator interface {34 // Current returns the last generated ID.35 Last() ID3637 // Next generates a new ID or panics if increasing ID overflows.38 Next() ID39}4041// NewIdentifierGenerator creates a new sequential unique identifier generator.42func NewIdentifierGenerator() IdentifierGenerator {43 return &idGenerator{}44}4546type idGenerator struct {47 last seqid.ID48}4950// Current returns the last generated ID.51func (g idGenerator) Last() ID {52 return ID(g.last)53}5455// Next generates a new ID or panics if increasing ID overflows.56func (g *idGenerator) Next() ID {57 return ID(g.last.Next())58}59Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.