activity

package
v0.6.19 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SinkTypeDB     = "db"
	SinkTypeStdout = "stdout"
	SinkTypeNone   = "none"
)

Variables

View Source
var (
	ErrInvalidUUID   = errors.New("invalid syntax of uuid")
	ErrInvalidData   = errors.New("invalid log data")
	ErrInvalidFilter = errors.New("invalid activity filter")
	ErrNotFound      = errors.New("activities not found")
)

Functions

This section is empty.

Types

type Actor added in v0.6.18

type Actor struct {
	ID    string
	Email string
}

type AppConfig added in v0.6.17

type AppConfig struct {
	Version string
}

type Filter added in v0.6.17

type Filter struct {
	Actor     string
	Action    string
	Data      map[string]string
	Metadata  map[string]string
	StartTime time.Time
	EndTime   time.Time
	Limit     int32
	Page      int32
}

type PagedActivity added in v0.6.17

type PagedActivity struct {
	Count      int32
	Activities []audit.Log
}

type Repository

type Repository interface {
	Insert(ctx context.Context, log *audit.Log) error
	List(ctx context.Context, filter Filter) ([]audit.Log, error)
}

type Service

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

func NewService

func NewService(appConfig AppConfig, repository Repository) *Service

func (Service) List added in v0.6.17

func (s Service) List(ctx context.Context, filter Filter) (PagedActivity, error)

func (Service) Log

func (s Service) Log(ctx context.Context, action string, actor Actor, data any) error

type StdoutRepository added in v0.6.17

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

func NewStdoutRepository added in v0.6.17

func NewStdoutRepository(writer io.Writer) *StdoutRepository

func (StdoutRepository) Insert added in v0.6.17

func (r StdoutRepository) Insert(ctx context.Context, log *audit.Log) error

func (StdoutRepository) List added in v0.6.17

func (r StdoutRepository) List(ctx context.Context, filter Filter) ([]audit.Log, error)

Jump to

Keyboard shortcuts

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