common

package
v0.0.0-...-e0474ae Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: MIT Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DREAM_SERVICE_KEY  = "tech-ngs-dream"
	ATHENA_SERVICE_KEY = "tech-ngs-athena"
)
View Source
const (
	CONSUL_ADDRESSES_KEY = "CONSUL_ADDRS"
)
View Source
const LOG_CONFIG = "logconfig.ini" //用于存放当前正在写入的日志文件名

Variables

View Source
var (
	ServerErr                  = model.NewResponseError("ServerErr", -1, 200, utils.ErrorTypeInternal)
	RequestParamsErr           = model.NewResponseError("Request parameter invalid", 999, 200, utils.ErrorTypePublic)
	StringConversionErr        = model.NewResponseError("string conversion invalid", 999, 400, utils.ErrorTypePublic)
	AuthErr                    = model.NewResponseError("Un Auth Access", 1, 401, utils.ErrorTypePublic)
	InsufficientPermissionsErr = model.NewResponseError("Insufficient permissions", 2, 403, utils.ErrorTypePublic)
	DeviceErr                  = model.NewResponseError("Device Token Error", 3, 401, utils.ErrorTypePublic)
	ServiceErr                 = model.NewResponseError("Servicer error", 500, 500, utils.ErrorTypePublic)
)
View Source
var (
	UserNotFoundErr       = model.NewResponseError("user not found", 1000, 200, utils.ErrorTypePublic)
	InvalidEmailAdressErr = model.NewResponseError("Invalid Email", 1001, 200, utils.ErrorTypePublic)
	InvalidPhoneNumberErr = model.NewResponseError("Invalid Phone Number", 1002, 200, utils.ErrorTypePublic)
	InvalidUserNameErr    = model.NewResponseError("Invalid User name", 1003, 200, utils.ErrorTypePublic)
	InvalidPasswordErr    = model.NewResponseError("Wrong Password", 1004, 200, utils.ErrorTypePublic)
	NameFormatErr         = model.NewResponseError("name format error", 1005, 200, utils.ErrorTypePublic)
	InvalidSecretCodeErr  = model.NewResponseError("secret code error", 1006, 200, utils.ErrorTypePublic)
	TimestampFormatErr    = model.NewResponseError("time stamp format error", 1007, 200, utils.ErrorTypePublic)
	AuthenticationErr     = model.NewResponseError("Authentication failure!", 1008, 200, utils.ErrorTypePublic)
)

account

Functions

func LoggerWithWriter

func LoggerWithWriter() gin.HandlerFunc

Instance a Logger middleware with the specified writter buffer. Example: os.Stdout, a file opened in write mode, a socket...

func SetGraphqlHandler

func SetGraphqlHandler(e *echo.Echo, path string, h *handler.Handler)

func ToEchoLogFile

func ToEchoLogFile(path string, log []byte, fileSizeLimit int64)

ToEchoLogFile 将日志打印到文件

func Wrapper

func Wrapper(c client.Client) client.Client

Types

type Controller

type Controller struct {
	RDB    *gorm.DB
	MDB    *mgo.Database
	User   *ml.User
	Broker broker.Broker
}

func NewMeanController

func NewMeanController(MDBSession *mgo.Session, MDB *mgo.Database) *Controller

type LogEntry

type LogEntry struct {
	*log.Entry
}

type MeanLogger

type MeanLogger struct {
	RequestID uuid.UUID
}

func NewLogger

func NewLogger() *MeanLogger

func NewMeanLogger

func NewMeanLogger() *MeanLogger

func (*MeanLogger) Print

func (l *MeanLogger) Print(values ...interface{})

func (*MeanLogger) Println

func (l *MeanLogger) Println(v ...interface{})

func (*MeanLogger) WithFields

func (l *MeanLogger) WithFields(fields log.Fields) *LogEntry

type PageModelBase

type PageModelBase struct {
	Count    int64       `json:"count,omitempty"`
	PageData interface{} `json:"list,omitempty"`
}

type ResultModel

type ResultModel struct {
	Errors []*model.ErrorMsgDefault `json:"errors,omitempty"`
	Data   interface{}              `json:"data,omitempty"`
}

params model that server return data and message info

func (ResultModel) Error

func (p ResultModel) Error() string

type SingleEntity

type SingleEntity struct {
	Validation model.NullBool `json:"validation,omitempty"`
	QNToken    string         `json:"QN-Token,omitempty"`
	Expires    *time.Time     `json:"QN-Expires,omitempty"`
}

type TimeWrapper

type TimeWrapper struct {
	client.Client
}

func (*TimeWrapper) Call

func (l *TimeWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error

Jump to

Keyboard shortcuts

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