events

package
v0.0.0-...-4d82e29 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventsTable = "cla.events"
)

EventsTable is the name of events table in database

Variables

View Source
var (
	ErrInvalidEventType = errors.New("invalid event type")
	ErrUserIDRequired   = errors.New("user_id cannot be empty")
)

ErrInvalidEventType,ErrUserIDRequired are errors

Functions

func Configure

func Configure(api *operations.ClaAPI, service Service)

Configure setups handlers on api with service

Types

type Repository

type Repository interface {
	CreateEvent(event *models.Event) error
	SearchEvents(ctx context.Context, params *events.SearchEventsParams) (*models.EventList, error)
}

Repository interface defines methods of event repository service

func NewRepository

func NewRepository(dbConn *sqlx.DB) Repository

NewRepository creates new instance of audit event repository

type SQLEvent

type SQLEvent struct {
	ID        sql.NullString `db:"id"`
	EventType sql.NullString `db:"event_type"`
	UserID    sql.NullString `db:"user_id"`
	ProjectID sql.NullString `db:"project_id"`
	CompanyID sql.NullString `db:"company_id"`
	EventTime sql.NullInt64  `db:"event_time"`
	EventData sql.NullString `db:"event_data"`
}

SQLEvent struct represent row of sql.events table

type Service

type Service interface {
	CreateEvent(event models.Event) error
	SearchEvents(ctx context.Context, params *events.SearchEventsParams) (*models.EventList, error)
}

Service interface defines methods of event service

func NewService

func NewService(repo Repository) Service

NewService creates new instance of event service

Jump to

Keyboard shortcuts

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