models

package
v0.0.0-...-aec2e1a Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SORT_UNKNOWN = iota
	TIME_DESC
	TIME_ASC
	PRIORITY_DESC
	PRIORITY_ASC
)

Variables

Functions

func AddFingerPrint

func AddFingerPrint(data map[string]interface{}) error

func AddRule

func AddRule(data map[string]interface{}) error

func DeleteFingerPrint

func DeleteFingerPrint(id uint) error

func DeleteRule

func DeleteRule(id uint) error

func GetEventInfo

func GetEventInfo(query map[string]interface{}) (map[string]interface{}, error)

func GetEvents

func GetEvents(query map[string]interface{}, page int, pageSize int) (map[string]interface{}, error)

func GetFingerPrintCount

func GetFingerPrintCount(query map[string]interface{}) (int, error)

func GetRuleCount

func GetRuleCount(query map[string]interface{}) (int, error)

func OpenDatabase

func OpenDatabase(cfg *config.DataBase, _storage storage.Storage) error

func SaveEvent

func SaveEvent(body interface{}) error

func UpdateFingerPrint

func UpdateFingerPrint(id uint, data map[string]interface{}) error

func UpdateRule

func UpdateRule(id uint, data map[string]interface{}) error

Types

type FingerPrint

type FingerPrint struct {
	Model

	Name        string `json:"name" gorm:"column:name;not null"`
	FingerPrint string `json:"fingerprint" gorm:"column:fingerprint;unique;default:''"`
	Remark      string `json:"remark" gorm:"column:remark;"`
}

func GetFingerPrint

func GetFingerPrint(id uint) (*FingerPrint, error)

func GetFingerPrints

func GetFingerPrints(query map[string]interface{}, page int, pageSize int) ([]*FingerPrint, error)

type Model

type Model struct {
	ID        uint      `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updateAt"`
}

type Rule

type Rule struct {
	Model

	Name     string `json:"name" gorm:"column:name;not null"`
	Time     int    `json:"time" gorm:"column:time"`
	Type     int    `json:"type" gorm:"column:type;default 0"`
	User     string `json:"user" gorm:"column:user;default:''"`
	IP       string `json:"ip"   gorm:"column:ip;default:''"`
	Db       string `json:"db"   gorm:"column:db;default:''"`
	RuleType int    `json:"ruletype" gorm:"column:ruletype;not null"`
	Op       int    `json:"op" gorm:"column:op;default:0"`
	Alert    int    `json:"alert" gorm:"column:alert;default:0"`

	Sql      string `json:"sql" gorm:"column:sql;default:''"`
	Match    int    `json:"match" gorm:"column:match;default:0"`
	Priority int    `json:"priority" gorm:"column:priority;default:0"`

	Remark string `json:"remark" gorm:"column:remark;"`
}

export const sqlOptions = [

{ key: 1, value: 'SELECT' },
{ key: 2, value: 'UNION' },
{ key: 3, value: 'INSERT' },
{ key: 4, value: 'UPDATE' },
{ key: 5, value: 'DELETE' },
{ key: 6, value: 'DDL' },
{ key: 7, value: 'SHOW' },
{ key: 8, value: 'USE' },
{ key: 9, value: 'SET' },
{ key: 10, value: 'BEGIN' },
{ key: 11, value: 'COMMIT' },
{ key: 12, value: 'ROLLBACK' },
{ key: 13, value: 'OTHERREAD' },
{ key: 14, value: 'OTHERADMIN' }

]

func GetRule

func GetRule(id uint) (*Rule, error)

func GetRules

func GetRules(query map[string]interface{}, page int, pageSize int) ([]*Rule, error)

Jump to

Keyboard shortcuts

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