Help us shape the future of Go! Take the 2026 Go Developer Survey

dbaudit

package module
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: MIT Imports: 9 Imported by: 1

README

dbaudit

Module for tracking create and update audit attributes for database records

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audit

type Audit struct {
	CreateClient    client.Client
	CreateUser      usr.User
	CreateTimestamp time.Time
	UpdateClient    client.Client
	UpdateUser      usr.User
	UpdateTimestamp time.Time
}

Audit represents fields meant to track when an action was taken and by whom

func NewForCreate added in v0.6.4

func NewForCreate(client *client.Client, user *usr.User) *Audit

NewForCreate is a constructor that takes a Client and User and populates CreateClient, CreateUser, UpdateClient and UpdateUser (as they all should be the same)

func NewFromContext added in v0.7.0

func NewFromContext(ctx context.Context) (*Audit, error)

NewFromContext is a constructor that takes a Client and User set to the Context and populates CreateClient, CreateUser, UpdateClient and UpdateUser (as they all should be the same for creates)

func TestDBAuditHelper added in v0.6.4

func TestDBAuditHelper(t *testing.T) *Audit

TestDBAuditHelper is a constructor for a dbAudit struct populating it with test data

func (Audit) Valid added in v0.6.0

func (a Audit) Valid() bool

Valid ensures that CreateClient, CreateUser, UpdateClient and UpdateUser are populated

Jump to

Keyboard shortcuts

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