mcauditlog

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 10 Imported by: 1

README

mcauditlog | github.com/abbeymart/mcauditlog

  • Transactions / audit log for data CRUD functions and access tracking
  • Includes audit/transaction logs to postgresDB
  • See the test file for different test cases / scenarios and usage

Documentation

Index

Constants

View Source
const (
	CreateLog = "create"
	UpdateLog = "update"
	ReadLog   = "read"
	GetLog    = "get"
	DeleteLog = "delete"
	RemoveLog = "remove"
	LoginLog  = "login"
	LogoutLog = "logout"
)

constants LogTypes

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLogger

type AccessLogger interface {
	LoginLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
	LogoutLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)
}

type AuditLogOptionsType

type AuditLogOptionsType struct {
	AuditTable    string
	TableName     string
	LogRecords    interface{}
	NewLogRecords interface{}
	QueryParams   interface{}
}

type AuditLogger

type AuditLogger interface {
	AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)
}

type AuditRecord added in v0.2.0

type AuditRecord struct {
	TableName     string      `json:"table_name,omitempty"`
	LogType       string      `json:"log_type,omitempty"`
	LogBy         string      `json:"log_by,omitempty"`
	LogAt         time.Time   `json:"log_at,omitempty"`
	LogRecords    interface{} `json:"log_records,omitempty"`
	NewLogRecords interface{} `json:"new_log_records,omitempty"`
}

type CreateLogger

type CreateLogger interface {
	CreateLog(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}

type DeleteLogger

type DeleteLogger interface {
	DeleteLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}

type LogParam

type LogParam struct {
	AuditDb    *sql.DB
	AuditTable string
}

interfaces / types

func NewAuditLog

func NewAuditLog(auditDb *sql.DB, auditTable string) LogParam

func (LogParam) AuditLog

func (log LogParam) AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)

func (LogParam) CreateLog

func (log LogParam) CreateLog(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)

func (LogParam) DeleteLog

func (log LogParam) DeleteLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)

func (LogParam) LoginLog

func (log LogParam) LoginLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)

func (LogParam) LogoutLog

func (log LogParam) LogoutLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)

func (LogParam) ReadLog

func (log LogParam) ReadLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)

func (LogParam) String

func (log LogParam) String() string

String() function implementation

func (LogParam) UpdateLog

func (log LogParam) UpdateLog(tableName string, logRecords interface{}, newLogRecords interface{}, userId string) (mcresponse.ResponseMessage, error)

type LogParamMongo added in v0.2.0

type LogParamMongo struct {
	AuditDb    *mongo.Database
	AuditTable string
}

interfaces / types

func NewAuditLogMongo added in v0.2.0

func NewAuditLogMongo(auditDb *mongo.Database, auditTable string) LogParamMongo

func (LogParamMongo) AuditLog added in v0.2.0

func (log LogParamMongo) AuditLog(logType, userId string, options AuditLogOptionsType) (mcresponse.ResponseMessage, error)

func (LogParamMongo) CreateLog added in v0.2.0

func (log LogParamMongo) CreateLog(table string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)

func (LogParamMongo) DeleteLog added in v0.2.0

func (log LogParamMongo) DeleteLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)

func (LogParamMongo) LoginLog added in v0.2.0

func (log LogParamMongo) LoginLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)

func (LogParamMongo) LogoutLog added in v0.2.0

func (log LogParamMongo) LogoutLog(logRecords interface{}, userId string, tableName string) (mcresponse.ResponseMessage, error)

func (LogParamMongo) ReadLog added in v0.2.0

func (log LogParamMongo) ReadLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)

func (LogParamMongo) String added in v0.2.0

func (log LogParamMongo) String() string

String() function implementation

func (LogParamMongo) UpdateLog added in v0.2.0

func (log LogParamMongo) UpdateLog(tableName string, logRecords interface{}, newLogRecords interface{}, userId string) (mcresponse.ResponseMessage, error)

type PgxAuditLogOptionsType added in v0.3.0

type PgxAuditLogOptionsType struct {
	AuditTable    string
	TableName     string
	LogRecords    interface{}
	NewLogRecords interface{}
	QueryParams   interface{}
}

type PgxLogParam added in v0.3.0

type PgxLogParam struct {
	AuditDb    *pgxpool.Pool
	AuditTable string
}

interfaces / types

func NewAuditLogPgx added in v0.3.0

func NewAuditLogPgx(auditDb *pgxpool.Pool, auditTable string) PgxLogParam

func (PgxLogParam) AuditLog added in v0.3.0

func (log PgxLogParam) AuditLog(logType, userId string, options PgxAuditLogOptionsType) (mcresponse.ResponseMessage, error)

func (PgxLogParam) String added in v0.3.0

func (log PgxLogParam) String() string

String() function implementation

type ReadLogger

type ReadLogger interface {
	ReadLog(tableName string, logRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}

type UpdateLogger

type UpdateLogger interface {
	UpdateLog(tableName string, logRecords interface{}, newLogRecords interface{}, userId string) (mcresponse.ResponseMessage, error)
}

Jump to

Keyboard shortcuts

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