envconf

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

go-env-conf

// TODO: Description // TODO: Developer Guide // TODO: Contribution Guide

Unit Tests

Running Tests
go test -v .
Coverage
go test -v . -coverprofile=coverage.out
go tool cover -func=coverage.out
go tool cover -html=coverage.out

Code Style

Running Linter

Install golint globally:

cd ~/ && go get -u golang.org/x/lint/golint

Find all linting issue for this project:

golint ./...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf interface{}

Conf is just an empty interface mask. This is useful for usage clarity.

func NewConf

func NewConf(c Conf, validations ...interface{}) (Conf, error)

NewConf returns a configuration structs.

type FieldValidation

type FieldValidation struct {
	Tag string
	Fn  func(fl validator.FieldLevel) bool
}

FieldValidation must have a Tag and Fn set. During the validation process of a Conf, each FieldValidation will be processed against each Conf field that has a matching Tag. When a Conf field has a matching Tag, then the custom Fn is processed. Docs: https://pkg.go.dev/github.com/go-playground/validator/v10#hdr-Custom_Validation_Functions Example: https://github.com/go-playground/validator/blob/master/_examples/custom-validation/main.go

type StructValidation

type StructValidation struct {
	Fn func(sl validator.StructLevel)
}

StructValidation must have a Fn set. During the validation process of a Conf, each StructValidation will be processed against the entire Conf struct, by processing the custom Fn. Example: https://github.com/go-playground/validator/blob/master/_examples/struct-level/main.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL