Documentation
¶
Index ¶
- type AdventCalendarDay
- type AdventCalendarDayUpdate
- type DayIDRequest
- type Repository
- func (r *Repository) Connect(username string, password string, address string, port int) (*mongo.Client, *context.Context, error)
- func (r *Repository) CreateDay(day *AdventCalendarDay, dbName, collectionName string) error
- func (r *Repository) CreateDb(dbName, collectionName string) error
- func (r *Repository) DeleteDay(day *DayIDRequest, dbName, collectionName string) error
- func (r *Repository) Disconnect()
- func (r *Repository) GetAllDatabase() ([]string, error)
- func (r *Repository) GetAllDay(dbName, collectionName string) ([]*AdventCalendarDay, error)
- func (r *Repository) GetDay(day uint8, dbName, collectionName string) (*AdventCalendarDay, error)
- func (r *Repository) PingDb() error
- func (r *Repository) UpdateDay(day *AdventCalendarDayUpdate, dbName, collectionName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdventCalendarDay ¶
type AdventCalendarDay struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` Day uint8 `bson:"day" json:"day" binding:"required" validate:"required,min=1,max=31"` Year uint16 `bson:"year" json:"year" binding:"required" validate:"required,min=1900,max=9999"` Title string `bson:"title" json:"title" binding:"required" validate:"required,min=1,max=255"` Content string `bson:"content" json:"content" binding:"required" validate:"required,min=1,max=65555"` }
type AdventCalendarDayUpdate ¶
type DayIDRequest ¶
type Repository ¶
func NewRepository ¶
func NewRepository(client *mongo.Client, ctx *context.Context) *Repository
Public functions
func (*Repository) CreateDay ¶
func (r *Repository) CreateDay(day *AdventCalendarDay, dbName, collectionName string) error
func (*Repository) CreateDb ¶
func (r *Repository) CreateDb(dbName, collectionName string) error
func (*Repository) DeleteDay ¶
func (r *Repository) DeleteDay(day *DayIDRequest, dbName, collectionName string) error
func (*Repository) Disconnect ¶
func (r *Repository) Disconnect()
func (*Repository) GetAllDatabase ¶
func (r *Repository) GetAllDatabase() ([]string, error)
func (*Repository) GetAllDay ¶
func (r *Repository) GetAllDay(dbName, collectionName string) ([]*AdventCalendarDay, error)
func (*Repository) GetDay ¶
func (r *Repository) GetDay(day uint8, dbName, collectionName string) (*AdventCalendarDay, error)
func (*Repository) PingDb ¶
func (r *Repository) PingDb() error
func (*Repository) UpdateDay ¶
func (r *Repository) UpdateDay(day *AdventCalendarDayUpdate, dbName, collectionName string) error
Click to show internal directories.
Click to hide internal directories.