randid

package module
v0.0.0-...-e559f53 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MIT Imports: 8 Imported by: 0

README

randid

Build Status Go Report Card GoDoc

Random ID generator using timestamp as prefix

Installation

go get github.com/moonrhythm/randid

Usage

package main

import (
    "fmt"

    "github.com/moonrhythm/randid"
)

func main() {
    id := randid.MustGenerate().String()
    fmt.Println(id)
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID [16]byte

func At

func At(t time.Time) ID

func FromString

func FromString(s string) (ID, error)

func Generate

func Generate() (ID, error)

func GenerateAt

func GenerateAt(t time.Time) (ID, error)

func MustGenerate

func MustGenerate() ID

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

func (*ID) Scan

func (id *ID) Scan(src interface{}) error

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(b []byte) error

func (ID) Value

func (id ID) Value() (driver.Value, error)

Directories

Path Synopsis
cmd
randid command

Jump to

Keyboard shortcuts

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