meta

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsErrNoRecord

func AsErrNoRecord(e error) bool

Types

type CacheService

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

func NewWithCache

func NewWithCache(s Service, c cache.Cache, l *zap.Logger) *CacheService

func (*CacheService) GetRoleRequirementForGuild

func (s *CacheService) GetRoleRequirementForGuild(action string, gid string) (string, error)

type ErrDuplicateEntry

type ErrDuplicateEntry struct{ M string }

func (*ErrDuplicateEntry) Error

func (e *ErrDuplicateEntry) Error() string

type ErrNoRecord

type ErrNoRecord struct{}

func (*ErrNoRecord) Error

func (e *ErrNoRecord) Error() string

type Event

type Event struct {
	ID        string    `db:"id"`
	GID       string    `db:"guild_id"`
	Name      string    `db:"name"`
	Begin     time.Time `db:"start_date"`
	End       time.Time `db:"end_date"`
	Active    bool      `db:"active"`
	EventType string    `db:"event_type"`
}

type EventService

type EventService interface {
	CreateEvent(
		name, eventType string,
		start, end time.Time,
		gid string,
		active bool,
	) (string, error)
	UpdateEvent(id, name, eventType string, start, end time.Time, gid string, active bool) error
	SetEventStatus(id string, status bool) error
	SetEventEndDate(id string, end time.Time) error
	GetEvent(id string) (*Event, error)
	ListAllEvent() ([]*Event, error)
	ListEventsForGuild(gid string) ([]*Event, error)
	ListActiveEventsForGuild(gid string) ([]*Event, error)
	DeleteEvent(id string) error
}

type IGNService

type IGNService interface {
	CreateIGN(userID, ign string) error
	GetIGN(userID string) (string, error)
	ListAllIGN() (map[string]string, error)
	UpdateIGN(userID, newIGN string) error
	DeleteRelation(userID string) error
}

type ParticipationService

type ParticipationService interface {
	AddParticipation(userID, eventID string, participating bool) (string, error)
	DeleteParticipation(id string) error
	DeleteParticipationByUserAndEvent(uid, eid string) error
	ListUserForEvent(eid string) (map[string]string, map[string]string, error)
	UserInEvent(uid, eid string) (bool, error)
	SetParticipation(id string, status bool) error
	SetParticipationByUserAndEvent(uid, eid string, status bool) error
	GetParticipation(uid, eid string) (string, bool, error)
}

type PostgresService

type PostgresService struct {
	DB                 *sqlx.DB
	ActionRoleTable    string
	Logger             *zap.Logger
	IGNTable           string
	EventsTable        string
	ParticipationTable string
}

func (*PostgresService) AddParticipation

func (ps *PostgresService) AddParticipation(
	userID, eventID string,
	particpating bool,
) (string, error)

func (*PostgresService) CreateEvent

func (ps *PostgresService) CreateEvent(
	name, eventType string,
	start, end time.Time,
	gid string,
	active bool,
) (string, error)

func (*PostgresService) CreateIGN

func (ps *PostgresService) CreateIGN(userID, ign string) error

IGN relation CRUD

func (*PostgresService) DeleteEvent

func (ps *PostgresService) DeleteEvent(id string) error

func (*PostgresService) DeleteParticipation

func (ps *PostgresService) DeleteParticipation(id string) error

func (*PostgresService) DeleteParticipationByUserAndEvent

func (ps *PostgresService) DeleteParticipationByUserAndEvent(uid, eid string) error

func (*PostgresService) DeleteRelation

func (ps *PostgresService) DeleteRelation(userID string) error

func (*PostgresService) GetEvent

func (ps *PostgresService) GetEvent(id string) (*Event, error)

func (*PostgresService) GetIGN

func (ps *PostgresService) GetIGN(userID string) (string, error)

func (*PostgresService) GetParticipation

func (ps *PostgresService) GetParticipation(uid, eid string) (string, bool, error)

func (*PostgresService) GetRoleRequirementForGuild

func (ps *PostgresService) GetRoleRequirementForGuild(action string, gid string) (string, error)

GetRoleRequirementForGuild returns empty string if there's no requirement

func (*PostgresService) ListActiveEventsForGuild

func (ps *PostgresService) ListActiveEventsForGuild(gid string) ([]*Event, error)

func (*PostgresService) ListAllEvent

func (ps *PostgresService) ListAllEvent() ([]*Event, error)

func (*PostgresService) ListAllIGN

func (ps *PostgresService) ListAllIGN() (map[string]string, error)

func (*PostgresService) ListEventsForGuild

func (ps *PostgresService) ListEventsForGuild(gid string) ([]*Event, error)

func (*PostgresService) ListUserForEvent

func (ps *PostgresService) ListUserForEvent(eid string) (yes, no map[string]string, e error)

func (*PostgresService) SetEventEndDate

func (ps *PostgresService) SetEventEndDate(id string, end time.Time) error

func (*PostgresService) SetEventStatus

func (ps *PostgresService) SetEventStatus(id string, status bool) error

func (*PostgresService) SetParticipation

func (ps *PostgresService) SetParticipation(id string, status bool) error

func (*PostgresService) SetParticipationByUserAndEvent

func (ps *PostgresService) SetParticipationByUserAndEvent(uid, eid string, status bool) error

func (*PostgresService) UpdateEvent

func (ps *PostgresService) UpdateEvent(
	id, name, eventType string,
	start, end time.Time,
	gid string,
	active bool,
) error

func (*PostgresService) UpdateIGN

func (ps *PostgresService) UpdateIGN(userID, newIGN string) error

func (*PostgresService) UserBailedEvent

func (ps *PostgresService) UserBailedEvent(uid, eid string) (bool, error)

func (*PostgresService) UserInEvent

func (ps *PostgresService) UserInEvent(uid, eid string) (bool, error)

type Service

type Service interface {
	GetRoleRequirementForGuild(action string, gid string) (string, error)
	IGNService
	EventService
	ParticipationService
}

Jump to

Keyboard shortcuts

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