repository

package
v0.0.0-...-023eac5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDB

func NewPostgresDB(cfg Config) (*sqlx.DB, error)

Types

type Booking

type Booking interface {
	Create(booking *model.Booking) (int, error)
	Delete(id int) error
	GetByRoomId(roomId int) ([]*model.Booking, error)
	GetById(id int) (*model.Booking, error)
}

type BookingPostgres

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

func NewBookingPostgres

func NewBookingPostgres(db *sqlx.DB) *BookingPostgres

func (*BookingPostgres) Create

func (r *BookingPostgres) Create(booking *model.Booking) (int, error)

func (*BookingPostgres) Delete

func (r *BookingPostgres) Delete(id int) error

func (*BookingPostgres) GetById

func (r *BookingPostgres) GetById(id int) (*model.Booking, error)

func (*BookingPostgres) GetByRoomId

func (r *BookingPostgres) GetByRoomId(roomId int) ([]*model.Booking, error)

type Config

type Config struct {
	Host     string
	Port     string
	Username string
	Password string
	DBName   string
	SSLMode  string
}

type Repository

type Repository struct {
	Room
	Booking
}

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

type Room

type Room interface {
	Create(room *model.Room) (int, error)
	Delete(id int) error
	GetAll(sortField string, desc bool) ([]*model.Room, error)
	GetById(id int) (*model.Room, error)
}

type RoomPostgres

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

func NewRoomPostgres

func NewRoomPostgres(db *sqlx.DB) *RoomPostgres

func (*RoomPostgres) Create

func (r *RoomPostgres) Create(room *model.Room) (int, error)

func (*RoomPostgres) Delete

func (r *RoomPostgres) Delete(id int) error

func (*RoomPostgres) GetAll

func (r *RoomPostgres) GetAll(sortField string, desc bool) ([]*model.Room, error)

func (*RoomPostgres) GetById

func (r *RoomPostgres) GetById(id int) (*model.Room, error)

Directories

Path Synopsis
Package mock_repository is a generated GoMock package.
Package mock_repository is a generated GoMock package.

Jump to

Keyboard shortcuts

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