applog

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetAction

func SetAction(opt AppLogOptions, diff DiffInterface) error

Types

type ActionType

type ActionType uint
const (
	Login ActionType = iota + 1
	Logout
	DataGet
	DataUpdate
	DataCreate
	DataDelete
)

func GetAction

func GetAction(httpMethod string) ActionType

type AppLog

type AppLog struct {
	models.BaseModel
	serializers.Serializer
	ID        uint                `json:"id" serializer:"read_only" gorm:"primarykey"`
	CreatedAt time.Time           `json:"createdAt" serializer:"read_only;title:Дата и время;"`
	UserID    uint                `json:"userId" serializer:"read_only;" gorm:"column:user_id"`
	Action    ActionType          `json:"action" serializer:"read_only;title:Действие;" gorm:"column:action"`
	Module    string              `json:"module" serializer:"read_only;title:Модуль;" gorm:"column:module"`
	Table     string              `json:"table" serializer:"read_only;title:Таблица;" gorm:"column:table"`
	User      authentication.User `` /* 145-byte string literal not displayed */
	Diff      typesdb.JSONB       `json:"diff" serializer:"read_only;title:Изменения;"  gorm:"type:jsonb;default:'{}';not null;column:diff"`
}

func (*AppLog) Create

func (log *AppLog) Create(db *gorm.DB) error

func (AppLog) TableName

func (AppLog) TableName() string

type AppLogDiffInterface

type AppLogDiffInterface interface {
	SetAction(AppLogOptions, DiffInterface) error
	GetAction(string) ActionType
}

type AppLogOptions

type AppLogOptions struct {
	User   *authentication.User
	DB     *gorm.DB
	Table  string
	Module string
	Method string
}

type DiffInterface

type DiffInterface interface {
	ToDict() map[string]interface{}
	CalcDifference() error
}

Jump to

Keyboard shortcuts

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