go-common

command module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

go-common

logs

Simple and fast, leveled log library.
Usage

logs.Info("info")
log := logs.New("MyLog")
log.SetLevel("trace")
log.Debug("debug")

output message like:
    common-logs: 2020-08-08T22:27:25+08:00 [info] logs.go@119: info
    MyLog: 2020-08-08T22:25:18+08:00 [debug] main.go@12: debug

http

Lightweight and high performance based on net/http. http router library.
Usage

type HelloController struct {
}

func (h *HelloController) Path() string{
	return "/"
}

func (h *HelloController) Execute(ctx router.Context) {
	user := ctx.Get("user")
	ctx.Put(user)
}

main.go
func main() {
	router.Registry(&HelloController{})

	router.Run(":8080")
}

config

simple conf file parser : file format.

  • key = value in a line.
  • namespace use . split in key.
    db.mysql.ip = 127.0.0.1
  • group by , like db.mysql.user = admin,abc
    template
 db.mysql.ip = 127.0.0.1
 db.mysql.port = 3306

code example

sc := config.New("test.conf")
ip, ok := sc.Get("db.mysql.ip")
if ok {
    fmt.Println(ip)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package config Simple Config File.
Package config Simple Config File.
Package db key/value database.
Package db key/value database.
Package logs Leveled Log Library.
Package logs Leveled Log Library.
Package mmap memory map file Copyright (C) 2020 to All Authors.
Package mmap memory map file Copyright (C) 2020 to All Authors.
Package router http router library.
Package router http router library.
Package test utils for test Copyright (C) 2020 to All Authors.
Package test utils for test Copyright (C) 2020 to All Authors.

Jump to

Keyboard shortcuts

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