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
Click to show internal directories.
Click to hide internal directories.