goprop

package module
v0.0.0-...-8ed5c8e Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2015 License: Apache-2.0 Imports: 5 Imported by: 39

README

goprop

Golang read the properties file

use

install

go get github.com/tjz101/goprop

prop.properties

port = 2770
driverName = mysql
dataSourceName = root:mysql99@tcp(127.0.0.1:3306)/capture?charset=utf8
maxOpenConns = 2000
maxIdleConns = 1000

main.go

package main

import (
	"fmt"
	"github.com/tjz101/goprop"
)

func main() {
	prop := goprop.NewProp()

	prop.Read("prop.properties")

	fmt.Println(prop.Get("port"))
	fmt.Println(prop.Get("driverName"))
	fmt.Println(prop.Get("dataSourceName"))
	fmt.Println(prop.Get("maxOpenConns"))
	fmt.Println(prop.Get("maxIdleConns"))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prop

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

func NewProp

func NewProp() *Prop

func (*Prop) Get

func (p *Prop) Get(key string) string

func (*Prop) Read

func (p *Prop) Read(propFileName string) error

Jump to

Keyboard shortcuts

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