From 60c5aeab4867d486554a4adc807de074da30ebde Mon Sep 17 00:00:00 2001 From: jackspirou Date: Sat, 14 Sep 2024 23:40:20 -0500 Subject: [PATCH] add generated README.md godc --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/README.md b/README.md index ee9b2d6..8ddab82 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,86 @@ if err != nil { // Output: Valid long ID: 7Zt3xY9pQr5W ``` + + + + +# publicid + +```go +import "github.com/agentstation/publicid" +``` + +## Index + +- [func New\(opts ...Option\) \(string, error\)](<#New>) +- [func NewLong\(opts ...Option\) \(string, error\)](<#NewLong>) +- [func Validate\(id string\) error](<#Validate>) +- [func ValidateLong\(fieldName, id string\) error](<#ValidateLong>) +- [type Option](<#Option>) + - [func Attempts\(n int\) Option](<#Attempts>) + + + +## func [New]() + +```go +func New(opts ...Option) (string, error) +``` + +New generates a unique nanoID with a length of 8 characters and the given options. + + +## func [NewLong]() + +```go +func NewLong(opts ...Option) (string, error) +``` + +NewLong generates a unique nanoID with a length of 12 characters and the given options. + + +## func [Validate]() + +```go +func Validate(id string) error +``` + +Validate checks if a given field name's public ID value is valid according to the constraints defined by package publicid. + + +## func [ValidateLong]() + +```go +func ValidateLong(fieldName, id string) error +``` + +validateLong checks if a given field name's public ID value is valid according to the constraints defined by package publicid. + + +## type [Option]() + +Option is a function type for configuring ID generation. + +```go +type Option func(*config) +``` + + +### func [Attempts]() + +```go +func Attempts(n int) Option +``` + +Attempts returns an Option to set the number of attempts for ID generation. + +Generated by [gomarkdoc]() + + + + + ## Makefile ```sh