operation

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CONFIG = Operation{
	Except: Route{
		Uri:    "api/v1/upload;api/v1/upload",
		Method: "post;put",
	},
	Include: Route{
		Uri:    "api/v1/menus",
		Method: "get",
	},
}

Functions

func CreateOplog

func CreateOplog(ol *Oplog) error

CreateOplog

func GetMigration

func GetMigration() *gormigrate.Migration

func IsExist added in v1.1.2

func IsExist() bool

IsExist config file is exist

func Recover added in v1.2.0

func Recover() error

Recover

func Remove added in v1.1.2

func Remove() error

Remove remove config file

Types

type Operation

type Operation struct {
	Except  Route `mapstructure:"except" json:"except" yaml:"except"`
	Include Route `mapstructure:"include" json:"include" yaml:"include"`
}

Operation Except set which routers don't generate system log, use ';' to separate. Include set which routers need to generate system log, use ';' to separate.

func (Operation) GetExcept

func (op Operation) GetExcept() ([]string, []string)

GetExcept return routers which need to excepted

func (Operation) GetInclude

func (op Operation) GetInclude() ([]string, []string)

GetInclude return routers which need to included

func (Operation) IsExcept

func (op Operation) IsExcept(uri, method string) bool

IsExcept check whether the current route needs to belong to the excepted data

func (Operation) IsInclude

func (op Operation) IsInclude(uri, method string) bool

IsInclude check whether the current route needs to belong to the included data

type Oplog

type Oplog struct {
	gorm.Model
	Ip           string        `json:"ip" form:"ip" gorm:"column:ip;comment:ip"`
	Method       string        `json:"method" form:"method" gorm:"column:method;comment:method" validate:"required"`
	Path         string        `json:"path" form:"path" gorm:"column:path;comment:path" validate:"required"`
	Status       int           `json:"status" form:"status" gorm:"column:status;comment:status" validate:"required"`
	Latency      time.Duration `json:"latency" form:"latency" gorm:"column:latency;comment:latency"`
	Agent        string        `json:"agent" form:"agent" gorm:"column:agent;comment:agent"`
	ErrorMessage string        `json:"errorMessage" form:"errorMessage" gorm:"column:error_message;comment:error_message"`
	Body         string        `json:"body" form:"body" gorm:"type:longtext;column:body;comment:body"`
	Resp         string        `json:"resp" form:"resp" gorm:"type:longtext;column:resp;comment:resp"`
	UserID       uint          `json:"userId" form:"userId" gorm:"column:user_id;comment:user_id"`
	TenancyId    uint          `json:"tenancyId" form:"tenancyId" gorm:"column:tenancy_id;comment:tenancyId"`
}

Oplog middleware model

type Route

type Route struct {
	Uri    string `mapstructure:"uri" json:"uri" yaml:"uri"`
	Method string `mapstructure:"method" json:"method" yaml:"method"`
}

Jump to

Keyboard shortcuts

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