Use fenced code blocks to enabled golang syntax highlighting in README.md

This commit is contained in:
Christian Wellenbrock 2013-09-23 18:32:11 +02:00
parent 586d18d326
commit 3c1e943e8d

View File

@ -1,14 +1,18 @@
Package uniuri
=====================
```go
import "github.com/dchest/uniuri"
```
Package uniuri generates random strings good for use in URIs to identify
unique objects.
Example usage:
```go
s := uniuri.New() // s is now "apHCJBl7L1OmC57n"
```
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
@ -23,6 +27,7 @@ read from it.
Constants
---------
```go
const (
// Standard length of uniuri string to achive ~95 bits of entropy.
StdLen = 16
@ -30,13 +35,16 @@ Constants
// to what can be losslessly converted to UUIDv4 (122 bits).
UUIDLen = 20
)
```
Variables
---------
```go
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
```
Standard characters allowed in uniuri string.
@ -46,21 +54,27 @@ Functions
### func New
```go
func New() string
```
New returns a new random string of the standard length, consisting of
standard characters.
### func NewLen
```go
func NewLen(length int) string
```
NewLen returns a new random string of the provided length, consisting of
standard characters.
### func NewLenChars
```go
func NewLenChars(length int, chars []byte) string
```
NewLenChars returns a new random string of the provided length, consisting
of the provided byte slice of allowed characters (maximum 256).