loggers

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypesNames = [...]string{
	"UPDATE_PASSWORD ",
	"CREATE_USER",
	"MACHINE_VERIFY",
	"LOGIN",
	"ACCEPT_MACHINE",
	"BLOCK_MACHINE",
	"SUSPECT_MACHINE",
}

Functions

func IsValidLoggerType

func IsValidLoggerType(y LoggerType) bool

func IsValidString added in v0.1.3

func IsValidString(typ string) bool

Types

type LogCreateRequest

type LogCreateRequest struct {
	Type        LoggerType `json:"type" db:"type"`
	Description string     `json:"description" db:"description"`
	UserId      int        `json:"user_id" db:"userId"`
}

type LogResponse

type LogResponse struct {
	ID          string    `json:"id" db:"id"`
	Type        string    `json:"type" db:"type"`
	Description string    `json:"description" db:"description"`
	UserId      int       `json:"user_id" db:"userid"`
	CreatedAt   time.Time `json:"created_at" db:"created_at"`
}

type LoggerType

type LoggerType int
const (
	UPDATE_PASSWORD LoggerType = iota
	CREATE_USER
	MACHINE_VERIFY
	LOGIN
	ACCEPT_MACHINE
	BLOCK_MACHINE
	SUSPECT_MACHINE
)

func (LoggerType) String

func (y LoggerType) String() string

type Logs

type Logs struct {
	Client *sqlx.DB
}

func New

func New(client *sqlx.DB) *Logs

func (*Logs) Create

func (y *Logs) Create(u LogCreateRequest) (id int64, err error)

func (*Logs) FindAll

func (y *Logs) FindAll(page, limit int, condition string) (res []LogResponse, err error)

func (*Logs) FindById

func (y *Logs) FindById(id int) (res LogResponse, err error)

func (*Logs) FindFirst

func (y *Logs) FindFirst() (res LogResponse, err error)

func (*Logs) FindLast

func (y *Logs) FindLast() (res LogResponse, err error)

func (*Logs) FindType

func (y *Logs) FindType(typ string, today bool) (res []LogResponse, err error)

Jump to

Keyboard shortcuts

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