common

package
v0.0.0-...-969198b Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2017 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(confPath string) error

Types

type AppConfig

type AppConfig struct {
	Addr       string
	DB         string
	DBUser     string
	DBPassword string
	DBHost     string
}
var Config AppConfig

type ErrorCode

type ErrorCode string
const (
	// General Error Code
	ErrUnknown  ErrorCode = "ERR_UNKNOWN"
	ErrArgument ErrorCode = "ERR_ARGUMENT"

	// User management Error Code
	ErrUserPasswrod      ErrorCode = "ERR_USER_PASSWORD"
	ErrUserConflictEmail ErrorCode = "ERR_USER_CONFLICT_EMAIL"
	ErrUserConflictName  ErrorCode = "ERR_USER_CONFLICT_NAME"
	ErrUserNotFound      ErrorCode = "ERR_USER_NOT_FOUND"
	ErrUserSamePassword  ErrorCode = "ERR_USER_SAME_PASSWORD"

	// Project Error Code
	ErrProjectNotFound ErrorCode = "ERR_PROJECT_NOT_FOUND"
	ErrProjectCreate   ErrorCode = "ERR_PROJECT_CREATE"
)

type OpError

type OpError struct {
	Code ErrorCode
}

func (OpError) Error

func (e OpError) Error() string

type RestResult

type RestResult struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data"`
	Error   OpError     `json:"error"`
}

RestResult represents that produces by rest api

func (*RestResult) SetData

func (r *RestResult) SetData(data interface{})

func (*RestResult) SetError

func (r *RestResult) SetError(err OpError)

func (*RestResult) SetErrorCode

func (r *RestResult) SetErrorCode(code ErrorCode)

func (*RestResult) SetSuccess

func (r *RestResult) SetSuccess(success bool)

Jump to

Keyboard shortcuts

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