db

package
v0.0.0-...-92f7cd3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Limit = 100

Limit is default limit

Variables

This section is empty.

Functions

This section is empty.

Types

type EventRepository

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

EventRepository is a repository for the event entity

func NewEventRepository

func NewEventRepository(repository *repository) (*EventRepository, error)

NewEventRepository creates a new Repository

func (EventRepository) Create

func (r EventRepository) Create(ctx context.Context, entity *event.Event) error

Create saves a new entity in the database.

func (EventRepository) Delete

func (r EventRepository) Delete(ctx context.Context, id uint) error

Delete deletes a record with the specified ID from the database.

func (EventRepository) Get

func (r EventRepository) Get(ctx context.Context, id uint) (*event.Event, error)

Get reads entities with the specified ID from the database.

func (EventRepository) ListForNotifications

func (r EventRepository) ListForNotifications(ctx context.Context, offset, limit uint) ([]event.Event, error)

ListForNotifications returns list of events for notification

func (EventRepository) Query

func (r EventRepository) Query(ctx context.Context, query *event.QueryCondition, offset, limit uint) ([]event.Event, error)

Query retrieves records with the specified offset and limit from the database.

func (EventRepository) SetHadNoticed

func (r EventRepository) SetHadNoticed(ctx context.Context, id uint) error

SetHadNoticed set event had noticed

func (EventRepository) Update

func (r EventRepository) Update(ctx context.Context, entity *event.Event) error

Update recoprd of entity in db

type IRepository

type IRepository interface{}

IRepository is an interface of repository

func GetRepository

func GetRepository(dbase db.IDB, logger log.ILogger, entity string) (repo IRepository, err error)

GetRepository return a repository

Jump to

Keyboard shortcuts

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