history

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(prev, curr map[string]any) (map[string]any, error)

func Snapshot

func Snapshot(tx *database.Transaction) (map[string]any, error)

func WithActor

func WithActor(ctx context.Context, a Actor) context.Context

Types

type Actor

type Actor struct {
	Type   database.TransactionHistoryActorType
	UserID *int32
	RuleID *int32
	Detail string
}

func ActorFromContext

func ActorFromContext(ctx context.Context) (Actor, bool)

func BulkActor

func BulkActor(userID int32, op string) Actor

func ImporterActor

func ImporterActor(name string) Actor

func RuleActor

func RuleActor(ruleID int32) Actor

func SchedulerActor

func SchedulerActor(ruleID int32) Actor

func UserActor

func UserActor(userID int32) Actor

type Reader

type Reader interface {
	List(ctx context.Context, transactionID int64) ([]*database.TransactionHistory, error)
}

type RecordRequest

type RecordRequest struct {
	Tx        *database.Transaction
	Previous  *database.Transaction
	EventType database.TransactionHistoryEventType
	Actor     Actor
}

type Recorder

type Recorder interface {
	Record(ctx context.Context, tx *gorm.DB, req RecordRequest) error
}

type Service

type Service struct{}

func NewService

func NewService() *Service

func (*Service) List

func (s *Service) List(ctx context.Context, transactionID int64) ([]*database.TransactionHistory, error)

func (*Service) Record

func (s *Service) Record(ctx context.Context, tx *gorm.DB, req RecordRequest) error

Jump to

Keyboard shortcuts

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