Merge pull request #1 from adeven/readme_syntax_highlighting
Use fenced code blocks to enabled golang syntax highlighting in README.md
This commit is contained in:
commit
9727604170
40
README.md
40
README.md
@ -1,14 +1,18 @@
|
|||||||
Package uniuri
|
Package uniuri
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
import "github.com/dchest/uniuri"
|
```go
|
||||||
|
import "github.com/dchest/uniuri"
|
||||||
|
```
|
||||||
|
|
||||||
Package uniuri generates random strings good for use in URIs to identify
|
Package uniuri generates random strings good for use in URIs to identify
|
||||||
unique objects.
|
unique objects.
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
s := uniuri.New() // s is now "apHCJBl7L1OmC57n"
|
```go
|
||||||
|
s := uniuri.New() // s is now "apHCJBl7L1OmC57n"
|
||||||
|
```
|
||||||
|
|
||||||
A standard string created by New() is 16 bytes in length and consists of
|
A standard string created by New() is 16 bytes in length and consists of
|
||||||
Latin upper and lowercase letters, and numbers (from the set of 62 allowed
|
Latin upper and lowercase letters, and numbers (from the set of 62 allowed
|
||||||
@ -23,20 +27,24 @@ read from it.
|
|||||||
Constants
|
Constants
|
||||||
---------
|
---------
|
||||||
|
|
||||||
const (
|
```go
|
||||||
// Standard length of uniuri string to achive ~95 bits of entropy.
|
const (
|
||||||
StdLen = 16
|
// Standard length of uniuri string to achive ~95 bits of entropy.
|
||||||
// Length of uniurl string to achive ~119 bits of entropy, closest
|
StdLen = 16
|
||||||
// to what can be losslessly converted to UUIDv4 (122 bits).
|
// Length of uniurl string to achive ~119 bits of entropy, closest
|
||||||
UUIDLen = 20
|
// to what can be losslessly converted to UUIDv4 (122 bits).
|
||||||
)
|
UUIDLen = 20
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Variables
|
Variables
|
||||||
---------
|
---------
|
||||||
|
|
||||||
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
|
```go
|
||||||
|
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
|
||||||
|
```
|
||||||
|
|
||||||
Standard characters allowed in uniuri string.
|
Standard characters allowed in uniuri string.
|
||||||
|
|
||||||
@ -46,21 +54,27 @@ Functions
|
|||||||
|
|
||||||
### func New
|
### func New
|
||||||
|
|
||||||
func New() string
|
```go
|
||||||
|
func New() string
|
||||||
|
```
|
||||||
|
|
||||||
New returns a new random string of the standard length, consisting of
|
New returns a new random string of the standard length, consisting of
|
||||||
standard characters.
|
standard characters.
|
||||||
|
|
||||||
### func NewLen
|
### func NewLen
|
||||||
|
|
||||||
func NewLen(length int) string
|
```go
|
||||||
|
func NewLen(length int) string
|
||||||
|
```
|
||||||
|
|
||||||
NewLen returns a new random string of the provided length, consisting of
|
NewLen returns a new random string of the provided length, consisting of
|
||||||
standard characters.
|
standard characters.
|
||||||
|
|
||||||
### func NewLenChars
|
### func NewLenChars
|
||||||
|
|
||||||
func NewLenChars(length int, chars []byte) string
|
```go
|
||||||
|
func NewLenChars(length int, chars []byte) string
|
||||||
|
```
|
||||||
|
|
||||||
NewLenChars returns a new random string of the provided length, consisting
|
NewLenChars returns a new random string of the provided length, consisting
|
||||||
of the provided byte slice of allowed characters (maximum 256).
|
of the provided byte slice of allowed characters (maximum 256).
|
||||||
|
Loading…
Reference in New Issue
Block a user