helper

package
v0.0.0-...-f3497b4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CliConf struct {
	Admin string
}

Cli config

View Source
var ConfItemMatcher = [...]*string{&DbConf.Username, &DbConf.Password, &DbConf.Addr, &DbConf.Port, &ServeConf.Addr, &ServeConf.Port, &CliConf.Admin}

Config file matcher

View Source
var ConfItems = [...]ConfItem{dbUsername, dbPassword, dbAddress, dbPort, serveAddress, servePort, authAdmin}

Config file items

View Source
var ConfPath struct {
	HomePath string
	ConfFile string
	ConfDir  string
}

Config path

View Source
var DbConf struct {
	Username string
	Password string
	Addr     string
	Port     string
}

Database config

View Source
var ServeConf struct {
	Addr string
	Port string
}

Serve config

View Source
var ServerInfo struct {
	StartTime  string
	ServerOS   string
	ServerArch string
}

serverInfo stores server info

View Source
var SupportedCommands = [...]Command{HELP, START, GEN, SET, LIST, AUTH, ADD, DEL}

Supported commands

Functions

func AddSession

func AddSession(name string, token string, r *http.Request) string

func CliLogger

func CliLogger(content string)

func ServerLogger

func ServerLogger(title string, content string, level LogLevel)

func ValidateSession

func ValidateSession(id string, r *http.Request) (string, bool)

Types

type Command

type Command string

Command is to defined supported command

const ADD Command = "add"

ADD command

const AUTH Command = "auth"

AUTH command

const DEL Command = "del"

DEL command

const GEN Command = "gen"

GEN command

const HELP Command = "help"

HELP command

const LIST Command = "list"

LIST command

const SERVE Command = "serve"

SERVE command

const SET Command = "set"

SET command

const START Command = "start"

START command

type ConfItem

type ConfItem string

Config file

type LogLevel

type LogLevel string

LogLevel is to defined logging level

const ERROR LogLevel = "ERROR"

ERROR level

const INFO LogLevel = "INFO"

INFO level

const WARN LogLevel = "WARN"

WARN level

type Message

type Message struct {
	ID        int    `json:"id"`
	Tag       string `json:"tag"`
	Admin     string `json:"admin"`
	Content   string `json:"content"`
	Timestamp string `json:"timestamp"`
}

message defines struct to store message data from database

Jump to

Keyboard shortcuts

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