Documentation ¶
Index ¶
Constants ¶
View Source
const MaxLIstLimit = 1000
MaxLIstLimit const
View Source
const (
// TableName const
TableName = "event"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { ID uint `json:"id"` UserID uint `db:"user_id" json:"userId"` Title string `json:"title"` Description *string `json:"description,omitempty"` Time time.Time Duration time.Duration `json:"duration"` NoticePeriod *time.Duration `db:"notice_period" json:"noticePeriod,omitempty"` NoticeTime *time.Time `db:"notice_time" json:"noticeTime"` }
Event entity
func (Event) Notification ¶
func (e Event) Notification() *notification.Notification
Notification returns a Notification object for a current Event object
func (*Event) UnmarshalJSON ¶
UnmarshalJSON is unmarshal func for an entity
type IRepository ¶
type IRepository interface { // Get returns an entity with the specified ID. Get(ctx context.Context, id uint) (*Event, error) // Count returns the number of entities. //Count(ctx context.Context) (uint, error) // Query returns the list of entities with the given offset and limit. Query(ctx context.Context, query *QueryCondition, offset, limit uint) ([]Event, error) // Create saves a new entity in the storage. Create(ctx context.Context, entity *Event) error // Update updates an entity with given ID in the storage. Update(ctx context.Context, entity *Event) error // Delete removes an entity with given ID from the storage. Delete(ctx context.Context, id uint) error // ListForNotifications returns list of events for notification ListForNotifications(ctx context.Context, offset, limit uint) ([]Event, error) // SetHadNoticed set event had noticed SetHadNoticed(ctx context.Context, id uint) error }
IRepository encapsulates the logic to access albums from the data source.
type IService ¶
type IService interface { // NewEntity returns new empty entity NewEntity() *Event // Get returns an entity with given ID Get(ctx context.Context, id uint) (*Event, error) //First(ctx context.Context, entity *Event) (*Event, error) // Query returns a list with pagination Query(ctx context.Context, offset, limit uint) ([]Event, error) // List entity List(ctx context.Context, condition *QueryCondition) ([]Event, error) //Count(ctx context.Context) (uint, error) // Create entity Create(ctx context.Context, entity *Event) error // Update entity Update(ctx context.Context, entity *Event) error // Delete entity Delete(ctx context.Context, id uint) error // NotificationsList returns a list of notification. NotificationsList(ctx context.Context) ([]*notification.Notification, error) // SetHadNoticed set event had noticed SetHadNoticed(ctx context.Context, id uint) error }
IService encapsulates usecase logic for event.
func NewService ¶
func NewService(repo IRepository, logger log.ILogger) IService
NewService creates a new service.
type QueryCondition ¶
type QueryCondition struct {
Where *WhereCondition
}
QueryCondition struct for defining a query condition
type WhereConditionTime ¶
WhereConditionTime struct
Click to show internal directories.
Click to hide internal directories.