Package Usage: go: github.com/kevinburke/go-types
Package types implements several types for dealing with REST API's and
databases.
UUID's are very useful, but you often need to attach context to them; e.g.
you cannot look at a UUID and know whether it points to a record in the
accounts table or in the messages table. A PrefixUUID solves this problem,
by embedding the additional useful information as part of the string.
If we had to write this value to the database as a string it would take up
43 bytes. Instead we use a UUID type and strip the prefix before saving it.
The converse, Value(), only returns the UUID part by default, since this
is the only thing the database knows about. You can also attach the prefix
manually in your SQL, like so:
This will get parsed as part of the Scan(), and then you don't need to
do anything. Alternatively, you can attach the prefix in your model,
immediately after the query.
A NullString is like the null string in `database/sql`, but can additionally
be encoded/decoded via JSON.
A NullTime behaves exactly like NullString, but the value is a time.Time.
1 version
Latest release: almost 4 years ago
153 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/kevinburke/go-types