jconfig

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2015 License: MIT Imports: 4 Imported by: 32

README

jconfig

This is a Go package to parse a configuration file using JSON.

It's really simple and does nothing fancy. We wouldn't have bothered releasing it except that a few other projects we will be releasing depend on it.

Installation

go get stathat.com/c/jconfig

import (
        "stathat.com/c/jconfig"
)

Usage

Examples available at www.stathat.com/c/jconfig.

Contact us

We'd love to hear from you if you are using this in your projects! Please drop us a line: @stathat or contact us here.

About

Written by Patrick Crosby at StatHat. Twitter: @stathat

Documentation

Overview

The jconfig package provides a simple, basic configuration file parser using JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(filename string) *Config

Loads config information from a JSON file

func LoadConfigString

func LoadConfigString(s string) *Config

Loads config information from a JSON string

func (*Config) GetArray

func (c *Config) GetArray(key string) []interface{}

Returns an array for the config variable key

func (*Config) GetBool

func (c *Config) GetBool(key string) bool

Returns a bool for the config variable key

func (*Config) GetFloat

func (c *Config) GetFloat(key string) float64

Returns a float for the config variable key

func (*Config) GetInt

func (c *Config) GetInt(key string) int

Returns an int for the config variable key

func (*Config) GetMap

func (c *Config) GetMap(key string) map[string]interface{}

Returns an map for the config variable key

func (*Config) GetString

func (c *Config) GetString(key string) string

Returns a string for the config variable key

func (*Config) LoadMerge

func (c *Config) LoadMerge(filename string)

func (*Config) StringMerge

func (c *Config) StringMerge(s string)

Jump to

Keyboard shortcuts

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