Skip to content

Commit

Permalink
add generated README.md godc
Browse files Browse the repository at this point in the history
  • Loading branch information
jackspirou committed Sep 15, 2024
1 parent ef1c988 commit 60c5aea
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,86 @@ if err != nil {
// Output: Valid long ID: 7Zt3xY9pQr5W
```
<!-- gomarkdoc:embed:start -->
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
# 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>)
<a name="New"></a>
## func [New](<https://github.com/agentstation/publicid/blob/main/publicid.go#L31>)
```go
func New(opts ...Option) (string, error)
```
New generates a unique nanoID with a length of 8 characters and the given options.
<a name="NewLong"></a>
## func [NewLong](<https://github.com/agentstation/publicid/blob/main/publicid.go#L36>)
```go
func NewLong(opts ...Option) (string, error)
```
NewLong generates a unique nanoID with a length of 12 characters and the given options.
<a name="Validate"></a>
## func [Validate](<https://github.com/agentstation/publicid/blob/main/publicid.go#L60>)
```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.

<a name="ValidateLong"></a>
## func [ValidateLong](<https://github.com/agentstation/publicid/blob/main/publicid.go#L66>)

```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.
<a name="Option"></a>
## type [Option](<https://github.com/agentstation/publicid/blob/main/publicid.go#L16>)
Option is a function type for configuring ID generation.
```go
type Option func(*config)
```
<a name="Attempts"></a>
### func [Attempts](<https://github.com/agentstation/publicid/blob/main/publicid.go#L24>)
```go
func Attempts(n int) Option
```
Attempts returns an Option to set the number of attempts for ID generation.
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
<!-- gomarkdoc:embed:end -->
## Makefile
```sh
Expand Down

0 comments on commit 60c5aea

Please sign in to comment.