Categorygithub.com/pfmt/serialkey
modulepackage
0.2.3
Repository: https://github.com/pfmt/serialkey.git
Documentation: pkg.go.dev

# README

serialkey

Build Status Go Reference

Dynamically named sequences for Go.
Source files are distributed under the BSD-style license.

About

The software is considered to be at a alpha level of readiness, its extremely slow and allocates a lots of memory.

PostgreSQL

Create table make postgresql or cat psql_create_table.sql | sed --expression='s/{{\.Table}}/serialkeys/g'

CREATE TABLE IF NOT EXISTS serialkeys (
    key text primary key,
    value bigint NOT NULL,
    created_at timestamp with time zone NOT NULL DEFAULT now(),
    updated_at timestamp with time zone
);

Benchmark

$ go test -count=1 -race -bench ./...
goos: linux
goarch: amd64
pkg: github.com/pfmt/serialkey
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
BenchmarkLocalNext/main_test.go:66-8         	 6259942	       200.5 ns/op
BenchmarkPgxNext/main_test.go:66-8           	    2852	    362782 ns/op
PASS
ok  	github.com/pfmt/serialkey	3.031s

# Packages

No description provided by the author

# Functions

LocalWithStart sets the start number.
NewLocal returns the serialkeys keychain based on the memory of the host where the module is running.
NewPgxPool returns the serialkeys keychain based on the pgx pool.
PgxPoolWithStart sets the start number.
PgxPoolWithTable sets the table name.

# Constants

No description provided by the author

# Variables

go:embed psql_create_table.sql.

# Structs

Local is the serialkeys keychain based on the local memory.
LocalConfiguration holds values changeable by options.
PgxPool is the serialkeys keychain based on the pgx pool.
PgxPoolConfiguration holds values changeable by options.
No description provided by the author

# Interfaces

Chain is the persistence interface for the serialkey sequences.

# Type aliases

LocalOption changes configuration.
PgxPoolOption changes configuration.