auditing

package
v0.379.1-next.6 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Insert = "insert"
	Update = "update"
	Delete = "delete"
)

Audit operations

View Source
const (
	ColumnId               = "id"
	ColumnTableName        = "table_name"
	ColumnOp               = "op"
	ColumnData             = "data"
	ColumnIdentityId       = "identity_id"
	ColumnTraceId          = "trace_id"
	ColumnCreatedAt        = "created_at"
	ColumnEventProcessedAt = "event_processed_at"
)

Audit table column names

View Source
const TableName = "keel_audit"

Audit table name

Variables

This section is empty.

Functions

func TestAuditOpFromCreatedEvent

func TestAuditOpFromCreatedEvent(t *testing.T)

func TestAuditOpFromDeletedEvent

func TestAuditOpFromDeletedEvent(t *testing.T)

func TestAuditOpFromUpdatedEvent

func TestAuditOpFromUpdatedEvent(t *testing.T)

func TestProcessEventSqlComplexTableName

func TestProcessEventSqlComplexTableName(t *testing.T)

func TestProcessEventSqlEmptyTraceId

func TestProcessEventSqlEmptyTraceId(t *testing.T)

func TestProcessEventSqlMultipleEventsManyAttribute

func TestProcessEventSqlMultipleEventsManyAttribute(t *testing.T)

func TestProcessEventSqlMultipleEventsOneAttribute

func TestProcessEventSqlMultipleEventsOneAttribute(t *testing.T)

func TestProcessEventSqlNoEvents

func TestProcessEventSqlNoEvents(t *testing.T)

func TestProcessEventSqlSingleEvent

func TestProcessEventSqlSingleEvent(t *testing.T)

func TestProcessEventSqlWithMultipleModels

func TestProcessEventSqlWithMultipleModels(t *testing.T)

Types

type AuditLog

type AuditLog struct {
	Id               string
	TableName        string
	Op               string
	Data             map[string]any
	CreatedAt        time.Time
	EventProcessedAt time.Time
}

func ProcessEventsFromAuditTrail

func ProcessEventsFromAuditTrail(ctx context.Context, schema *proto.Schema, traceId string) ([]*AuditLog, error)

ProcessEventsFromAuditTrail inspects the audit table for logs which need to be turned into events, updates their event_processed_at column, and then returns them.

Jump to

Keyboard shortcuts

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