README update.

This commit is contained in:
Stanislav Nikitin 2019-09-17 19:00:03 +05:00
parent f626ea86aa
commit 2b9eb769d6
No known key found for this signature in database
GPG Key ID: 106900B32F8192EE
1 changed files with 23 additions and 2 deletions

View File

@ -24,7 +24,7 @@ Go modules and dep are supported. Other package managers might or might not work
## Usage
SEC is designed to be easy to use parser, so there is only one requirement - passed data should be a structure. You cannot do something like:
SEC is designed to be easy to use parser, so there is only one requirement - passed data should be a pointer to structure. You cannot do something like:
```go
var Data string
@ -35,8 +35,29 @@ This will throw errors, as any type you'll pass, except for pointer to structure
SEC is unable to parse embedded unexported things except structures due to inability to get embedded field's address. Embed only structures, please.
The very valid way to use SEC:
```go
type config struct{
Database struct{
URI string
Options string
}
HTTPTimeout int
}
cfg := &config{}
err := Parse(cfg, nil)
if err != nil {
log.Fatal(err)
}
```
No field tags supported yet, this in ToDo.
### Debug
To get additional debug output set ``SEC_DEBUG`` environment variable to ``true``. If invalid boolean value will be passed it'll output error about that.
Debug output uses standart log package. This may change in future.
Debug output uses standart log package. This may change in future.