pika

package module
v0.0.0-...-4b39d56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: CC0-1.0 Imports: 7 Imported by: 0

README

pika-go

pika id system go implementation. see phineas/pika for the original specification.

usage

package main

import (
    "fmt"
    "codeberg.org/elisiei/pika-go"
)

func main() {
    pika.Init(1)

    pika.Register("user", false)
    pika.Register("session", true)

    id, _ := pika.Generate("user")
    fmt.Println(id) // user_<base64 tail>

    sid, _ := pika.Generate("session")
    fmt.Println(sid) // session_<base64 crypto tail>

    ts, _ := pika.Timestamp(id)
    fmt.Println(ts) // 2025-01-01 00:00:00 +0000 utc
}

license

cc0 1.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(prefix string) (string, error)

func Init

func Init(id int64) error

func Register

func Register(prefix string, crypto bool) error

func Timestamp

func Timestamp(id string) (time.Time, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL