Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

CConf

GoDoc Go Report Card MIT licensed

Introduction

CConf is a Go package for handling configurations in Go applications. cconf references ozzo-config, but higher performance.

Download & Install

go get github.com/syyongx/cconf

Features

  1. Loading configuration file, default JSON.
  2. Dynamic setting configuration.

Requirements

Go 1.2 or above.

Quick Start

import github.com/syyongx/cconf

func main() {
    c := cconf.New()
    age := c.GetInt("age", 18)
    name := c.Get("name").(string)
    c.Set("email", "default@default.com")
    email := c.GetString("email")
}

Apis

New() *Conf
RegisterLoadFunc(typ string, fn loadFunc)
Load(files ...string) error
LoadWithPattern(pattern string) error

Set(key string, val interface{}) error
Get(key string, def ...interface{}) interface{}
GetString(key string, def ...string) string
GetInt(key string, def ...int) int
GetInt64(key string, def ...int64) int64
GetFloat(key string, def ...float64) float64
GetBool(key string, def ...bool) bool

SetStore(data ...interface{})
GetStore() interface{}

Register(name string, provider interface{}) error
Populate(v interface{}, key ...string) (err error)

LICENSE

CConf source code is licensed under the MIT Licence.

About

CConf - Go config library.

Resources

License

Packages

No packages published

Languages