common

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: MIT Imports: 16 Imported by: 0

README

common

公用方法

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App added in v0.0.3

type App struct {
	DB     *gorm.DB
	CS     *Service
	Router Router
	Log    *golog.Logger
}

App 应用

func NewApp added in v0.0.3

func NewApp(db *gorm.DB, cs *Service, router Router) *App

NewApp 新建应用

func (*App) Run added in v0.0.3

func (a *App) Run(c *Config)

Run 运行

type Command

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

Command 命令行

func NewCommand

func NewCommand(cmd *cobra.Command) *Command

NewCommand 新疆命令行参数

func (*Command) Bool

func (c *Command) Bool(name string) bool

Bool 读取配置String

func (*Command) Int

func (c *Command) Int(name string) int

Int 读取配置Int

func (*Command) String

func (c *Command) String(name string) string

String 读取配置String

type Config added in v0.0.3

type Config struct {
	Address   string // 监听端口
	Secret    []byte // JWT密钥
	MockID    string // 模拟用户ID
	Develop   bool   // 开发模式
	Redirect  string // 重定向目录
	LogDir    string // 日志目录
	StaticDir string // 静态资源目录
}

Config 配置信息

type FieldError

type FieldError struct {
	Field string `json:"field"` // 字段
	Tag   string `json:"tag"`   // 标签
	Param string `json:"param"` // 参数
}

FieldError 字段错误信息

type Partyer added in v0.0.3

type Partyer interface {
	Party(p iris.Party)
}

Partyer 服务注册

type Router added in v0.0.3

type Router interface {
	// Auth 身份认证
	Auth() Partyer
	// API 应用接口
	API() Partyer
}

Router 路由器

type Service

type Service struct {
	Logger *golog.Logger
	// contains filtered or unexported fields
}

Service 公共服务

func NewService

func NewService() *Service

NewService 新建公共服务

func (*Service) Bind

func (s *Service) Bind(ctx iris.Context, obj interface{}, errMsg string) bool

Bind 对象绑定

func (*Service) Get

func (s *Service) Get(url string, p interface{}) error

Get 请求

func (*Service) Int

func (s *Service) Int(ctx iris.Context, name, errMsg string) int

Int 路径中的整数

func (*Service) String

func (s *Service) String(ctx iris.Context, name, errMsg string) string

String 路径中的字符串

func (*Service) URLInt

func (s *Service) URLInt(ctx iris.Context, name, errMsg string) int

URLInt query中的整数

func (*Service) URLString

func (s *Service) URLString(ctx iris.Context, name, errMsg string) string

URLString query中的字符串

Jump to

Keyboard shortcuts

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