events

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataProvider

type DataProvider interface {
	Create(RegisteredEvent) error
	Update(RegisteredEvent) error
	GetByTypeAndEvent(string, string, string) (*RegisteredEvent, error)
	GetLast(limit int) ([]*RegisteredEvent, error)
}

todo: add unit tests

type RegisteredEvent

type RegisteredEvent struct {
	gorm.Model

	Type   string // dao/proposal etc
	TypeID string // type identifier: dao.id, proposal.id, etc
	Event  string // core.proposal.created, etc
}

type Repo

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

func NewRepo

func NewRepo(db *gorm.DB) *Repo

func (*Repo) Create

func (r *Repo) Create(e RegisteredEvent) error

func (*Repo) GetByTypeAndEvent

func (r *Repo) GetByTypeAndEvent(id, t, event string) (*RegisteredEvent, error)

func (*Repo) GetLast

func (r *Repo) GetLast(limit int) ([]*RegisteredEvent, error)

func (*Repo) Update

func (r *Repo) Update(e RegisteredEvent) error

type Service

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

func NewService

func NewService(r DataProvider) (*Service, error)

func (*Service) EventExist

func (s *Service) EventExist(_ context.Context, id, t, event string) (bool, error)

func (*Service) RegisterEvent

func (s *Service) RegisterEvent(_ context.Context, id, t, event string) error

Jump to

Keyboard shortcuts

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