app

package module
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 11 Imported by: 83

README

app-starter

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOrm

func GetOrm() *persistence.OrmContext

func RecordRequest added in v1.1.6

func RecordRequest(costTime time.Duration)

Types

type Application

type Application interface {
	Start(buildHandler func(ctx context.Context, builder *ApplicationBuilder) error, onTerminate func(string)) error
}

func New

func New() (instance Application)

type ApplicationBuilder added in v1.2.1

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

func (*ApplicationBuilder) ComponentAfter added in v1.2.1

func (h *ApplicationBuilder) ComponentAfter(component func(context.Context) (err error)) *ApplicationBuilder

func (*ApplicationBuilder) ComponentBefore added in v1.2.1

func (h *ApplicationBuilder) ComponentBefore(component func(context.Context) (err error)) *ApplicationBuilder

func (*ApplicationBuilder) EnableDatabase added in v1.2.1

func (h *ApplicationBuilder) EnableDatabase(config persistence.BaseConfig,
	models ...interface{}) *ApplicationBuilder

func (*ApplicationBuilder) EnableStaticWeb added in v1.2.1

func (h *ApplicationBuilder) EnableStaticWeb(vdir, home string,
	assetInfo func(name string) (os.FileInfo, error),
	asset func(string) ([]byte, error),
	assetNames func() []string) *ApplicationBuilder

func (*ApplicationBuilder) EnableWeb added in v1.2.1

func (h *ApplicationBuilder) EnableWeb(listen string, components ...server.Component) *ApplicationBuilder

func (*ApplicationBuilder) LoadConfig added in v1.2.1

func (h *ApplicationBuilder) LoadConfig(config interface{}, callback func(etc.Loader)) (err error)

type M added in v1.1.6

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

type Monitor added in v1.1.6

type Monitor struct {
	AppStartTime  string `json:"startTime"`
	RequestAmount int    `json:"requests"`
	MaxCost       string `json:"maxCost,omitempty"`
	MinCost       string `json:"minCost,omitempty"`
	CostAverage   string `json:"costAverage,omitempty"`
}

func GetStatus added in v1.1.6

func GetStatus() Monitor

type Pager added in v1.1.3

type Pager struct {
	TotalPage int           `json:"totalPage"` // 总页数
	PageSize  int           `json:"pageSize"`  // 页面大小
	PageNum   int           `json:"pageNum"`   // 页号
	More      int           `json:"more"`      // 是否有下一页
	Data      []interface{} `json:"items,omitempty"`
}

type PagerResponse added in v1.1.3

type PagerResponse struct {
	Response
	Pager
}

type Response added in v1.1.3

type Response struct {
	Code    interface{} `json:"code,omitempty"`
	Success interface{} `json:"success,omitempty"`
	Message string      `json:"message,omitempty"`
}

func (*Response) SetCode added in v1.1.3

func (r *Response) SetCode(code int) *Response

func (*Response) SetSuccess added in v1.1.3

func (r *Response) SetSuccess(success bool) *Response

Directories

Path Synopsis
application
api

Jump to

Keyboard shortcuts

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