svc

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultFormat

func DefaultFormat(interface{}) func(interface{}) interface{}

DefaultFormat defined

func DefaultHandler

func DefaultHandler(source map[string]interface{}) map[string]interface{}

DefaultHandler defined

func OptionsetsFormat

func OptionsetsFormat(db *xorm.Engine) func(interface{}) func(interface{}) interface{}

OptionsetsFormat defiend

Types

type Cache

type Cache interface {
	SetCache(key string, v interface{}, expire time.Duration) error
	GetCache(key string, v interface{}) error
}

Cache defined TODO

type Db

type Db interface {
	PageSearch(*xorm.Engine, string, string, string, map[string]interface{}, ...Formatter) (*types.PageList, error)
	TreeSearch(*xorm.Engine, string, string, string, map[string]interface{}, ...Formatter) (interface{}, error)
	GetOptions(*xorm.Engine, ...string) (map[string]map[string]interface{}, error)
	InRole(*xorm.Engine, string, ...string) bool
	InAdmin(*xorm.Engine, string, ...string) bool
	Persist(db *xorm.Session, ids ...string) (int64, error)
	PersistFile(db *xorm.Session, cb func([]types.SysAttachment) error, ids ...string) (int64, error)
	Remove(db *xorm.Session, ids ...string) (int64, error)
	RemoveFile(db *xorm.Session, cb func([]types.SysAttachment) error, ids ...string) (int64, error)
}

Db defined TODO

type Export

type Export interface {
	Check(*gin.Context) bool
	PageExport(*xorm.Engine, string, string, string, map[string]interface{}, ...Formatter) (*types.ExportInfo, error)
	ParseExcel(r io.Reader, sheet interface{}, header ...[]map[string]interface{}) ([]map[string]string, error)
	SetOptionsetsFormat(func(interface{}) func(interface{}) interface{})
}

Export defined TODO

type Formatter

type Formatter func(*xorm.Engine, []map[string]interface{}) ([]map[string]interface{}, error)

Formatter defined TODO

type Http

type Http interface {
	// Get returns *HttpRequest with GET method.
	Get(url string) *http.HttpRequest
	// Post returns *HttpRequest with POST method.
	Post(url string) *http.HttpRequest
	// Put returns *HttpRequest with PUT method.
	Put(url string) *http.HttpRequest
	// Delete returns *HttpRequest DELETE method.
	Delete(url string) *http.HttpRequest
	// Head returns *HttpRequest with HEAD method.
	Head(url string) *http.HttpRequest
}

Http defined TODO

type Svc

type Svc interface {
	Export
	Cache
	Http
	Db
}

Svc defined TODO

func NewSvcHepler

func NewSvcHepler(rds redis.Cmdable) Svc

NewSvcHepler defined TODO

type SvcHepler

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

SvcHepler defined TODO

func (*SvcHepler) Check

func (svc *SvcHepler) Check(ctx *gin.Context) bool

Check defined TODO

func (*SvcHepler) Delete

func (svc *SvcHepler) Delete(url string) *http.HttpRequest

Delete returns *HttpRequest DELETE method.

func (*SvcHepler) Get

func (svc *SvcHepler) Get(url string) *http.HttpRequest

Get returns *HttpRequest with GET method.

func (*SvcHepler) GetCache

func (svc *SvcHepler) GetCache(key string, v interface{}) error

GetCache defined TODO

func (*SvcHepler) GetOptions

func (svc *SvcHepler) GetOptions(db *xorm.Engine, keys ...string) (map[string]map[string]interface{}, error)

GetOptions defined TODO

func (*SvcHepler) Head

func (svc *SvcHepler) Head(url string) *http.HttpRequest

Head returns *HttpRequest with HEAD method.

func (*SvcHepler) InAdmin

func (svc *SvcHepler) InAdmin(db *xorm.Engine, userId string, role ...string) bool

InAdmin defined TODO

func (*SvcHepler) InRole

func (svc *SvcHepler) InRole(db *xorm.Engine, userId string, role ...string) bool

InRole defined TODO

func (*SvcHepler) PageExport

func (svc *SvcHepler) PageExport(db *xorm.Engine, ctr, api, table string, params map[string]interface{}, formatters ...Formatter) (*types.ExportInfo, error)

PageExport defined TODO

func (*SvcHepler) PageSearch

func (svc *SvcHepler) PageSearch(db *xorm.Engine, ctr, api, table string, params map[string]interface{}, formatters ...Formatter) (*types.PageList, error)

PageSearch defined TODO

func (*SvcHepler) ParseExcel added in v1.2.3

func (svc *SvcHepler) ParseExcel(r io.Reader, sheet interface{}, header ...[]map[string]interface{}) ([]map[string]string, error)

ParseExcel defined TODO

func (*SvcHepler) Persist

func (svc *SvcHepler) Persist(db *xorm.Session, ids ...string) (int64, error)

Persist defined TODO

func (*SvcHepler) PersistFile

func (svc *SvcHepler) PersistFile(db *xorm.Session, cb func([]types.SysAttachment) error, ids ...string) (int64, error)

PersistFile defined TODO

func (*SvcHepler) Post

func (svc *SvcHepler) Post(url string) *http.HttpRequest

Post returns *HttpRequest with POST method.

func (*SvcHepler) Put

func (svc *SvcHepler) Put(url string) *http.HttpRequest

Put returns *HttpRequest with PUT method.

func (*SvcHepler) Remove

func (svc *SvcHepler) Remove(db *xorm.Session, ids ...string) (int64, error)

Remove defined TODO

func (*SvcHepler) RemoveFile

func (svc *SvcHepler) RemoveFile(db *xorm.Session, cb func([]types.SysAttachment) error, ids ...string) (int64, error)

RemoveFile defined TODO

func (*SvcHepler) SetCache

func (svc *SvcHepler) SetCache(key string, v interface{}, expire time.Duration) error

SetCache defined TODO

func (*SvcHepler) SetOptionsetsFormat

func (svc *SvcHepler) SetOptionsetsFormat(funk func(interface{}) func(interface{}) interface{})

SetOptionsetsFormat definedTODO

func (*SvcHepler) TreeSearch

func (svc *SvcHepler) TreeSearch(db *xorm.Engine, controller, api, table string, q map[string]interface{}, formatters ...Formatter) (interface{}, error)

TreeSearch defined TODO

type Xlsx

type Xlsx struct {
	SheetIndex interface{}
	FileName   string
	SheetName  string
	Header     []map[string]interface{}
	TmplPath   string
	Format     func(interface{}) func(interface{}) interface{}
	Handler    func(map[string]interface{}) map[string]interface{}
	// contains filtered or unexported fields
}

Xlsx defined

func NewXlsx

func NewXlsx(header ...[]map[string]interface{}) *Xlsx

NewXlsx defined TODO

func (*Xlsx) DumpRows

func (xlsx *Xlsx) DumpRows(rows ...map[string]interface{}) *Xlsx

AddRows defined

func (*Xlsx) ExportInfo

func (xlsx *Xlsx) ExportInfo() (*types.ExportInfo, error)

AddRows defined

func (*Xlsx) ParseExcel

func (xlsx *Xlsx) ParseExcel(r io.Reader, header ...[]map[string]interface{}) ([]map[string]string, error)

ParseExcel defined TODO

Jump to

Keyboard shortcuts

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