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

audit

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TimeNow = time.Now

	ErrInvalidMetadata = errors.New("failed to cast existing metadata to map[string]interface{} type")
)

Functions

func WithActor

func WithActor(ctx context.Context, actor string) context.Context

func WithMetadata

func WithMetadata(ctx context.Context, md map[string]interface{}) (context.Context, error)

Types

type AuditOption

type AuditOption func(*Service)

func WithActorExtractor

func WithActorExtractor(fn func(context.Context) (string, error)) AuditOption

func WithMetadataExtractor

func WithMetadataExtractor(fn func(context.Context) map[string]interface{}) AuditOption

func WithRepository

func WithRepository(r repository) AuditOption

type Log

type Log struct {
	Timestamp time.Time
	Action    string
	Actor     string
	Data      interface{}
	Metadata  interface{}
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...AuditOption) *Service

func (*Service) Log

func (s *Service) Log(ctx context.Context, action string, data interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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