db

package
v0.0.0-...-9fdab00 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type City

type City struct {
	CityId   int    `json:"city_id"`
	CityName string `json:"city_name"`
}

type CityTour

type CityTour struct {
	Id     int `json:"id"`
	TourId int `json:"tour_id"`
	CityId int `json:"city_id"`

	CityTourPrice float64 `json:"city_tour_price"`

	DateFrom string `json:"date_from"`
	DateTo   string `json:"date_to"`

	TicketArrivalId   int `json:"ticket_arrival_id"`
	TicketDepartureId int `json:"ticket_departure_id"`

	HotelId int `json:"hotel_id"`
}

type CityTourData

type CityTourData struct {
	Id int `json:"city_tour_id"`

	CountryName   string `json:"country_name"`
	CityId        int    `json:"city_id"`
	CityName      string `json:"city_name"`
	CityTourPrice string `json:"city_tour_price"`

	DateFrom string `json:"date_from"`
	DateTo   string `json:"date_to"`

	TicketArrivalId   int `json:"ticket_arrival_id"`
	TicketDepartureId int `json:"ticket_departure_id"`

	HotelId int `json:"hotel_id"`
}

type CityTourTicketData

type CityTourTicketData struct {
	ArrivalTicket   TicketData `json:"arrival_ticket"`
	DepartureTicket TicketData `json:"departure_ticket"`
}

type CityTourTicketIdData

type CityTourTicketIdData struct {
	TicketArrivalId   int `json:"ticket_arrival_id"`
	TicketDepartureId int `json:"ticket_departure_id"`
}

type CityToursEvent

type CityToursEvent struct {
	CtId    int `json:"ct_id"`
	EventId int `json:"event_id"`
}

type CityToursRestBooking

type CityToursRestBooking struct {
	CtId int `json:"ct_id"`
	RbId int `json:"rb_id"`
}

type Event

type Event struct {
	EventId          int    `json:"event_id"`
	EventName        string `json:"event_name"`
	EventDescription string `json:"event_description"`
	EventAddr        string `json:"event_addr"`

	CountryName string `json:"country_name"`
	CityName    string `json:"city_name"`

	EventStart string  `json:"event_start"`
	EventEnd   string  `json:"event_end"`
	Price      string  `json:"price"`
	Rating     float64 `json:"rating"`

	MaxPersons int      `json:"max_persons"`
	CurPersons int      `json:"cur_persons"`
	Languages  []string `json:"languages"`
}

type EventData

type EventData struct {
	Id        int    `json:"event_id"`
	EventName string `json:"event_name"`

	EventStart string  `json:"event_start"`
	EventEnd   string  `json:"event_end"`
	Price      string  `json:"price"`
	Rating     float64 `json:"rating"`

	MaxPersons int `json:"max_persons"`
	CurPersons int `json:"cur_persons"`
}

type EventFeedItem

type EventFeedItem struct {
	EventId   int    `json:"event_id"`
	EventName string `json:"event_name"`

	EventStart string  `json:"event_start"`
	EventEnd   string  `json:"event_end"`
	Rating     float64 `json:"rating"`

	MaxPersons int `json:"max_persons"`
	CurPersons int `json:"cur_persons"`

	CountryName string `json:"country_name"`
	CityName    string `json:"city_name"`
}

type EventsFilterParameters

type EventsFilterParameters struct {
	Limit     int    `form:"limit"`
	Offset    int    `form:"offset"`
	OrderBy   string `form:"order_by"`
	OrderType string `form:"order_type"`

	EventName  string  `form:"event_name"`
	From       string  `form:"from"`
	To         string  `form:"to"`
	RatingFrom float64 `form:"rating_from"`
	RatingTo   float64 `form:"rating_to"`
	PriceFrom  float64 `form:"price_from"`
	PriceTo    float64 `form:"price_to"`

	CityName string `form:"city_name"`
}

type Hotel

type Hotel struct {
	HotelId          int    `json:"hotel_id"`
	HotelName        string `json:"hotel_name"`
	HotelDescription string `json:"hotel_description"`
	HotelAddr        string `json:"hotel_addr"`

	Stars       int     `json:"stars"`
	HotelRating float64 `json:"hotel_rating"`
	AvgPrice    string  `json:"average_price"`

	NearSea bool `json:"near_sea"`

	CountryName string `json:"country_name"`
	CityName    string `json:"city_name"`
}

type HotelData

type HotelData struct {
	Id        int    `json:"hotel_id"`
	HotelName string `json:"hotel_name"`

	Stars       int     `json:"stars"`
	HotelRating float64 `json:"hotel_rating"`
}

type HotelFeedItem

type HotelFeedItem struct {
	HotelId     int     `json:"hotel_id"`
	HotelName   string  `json:"hotel_name"`
	Stars       int     `json:"stars"`
	HotelRating float64 `json:"hotel_rating"`

	CountryName string `json:"country_name"`
	CityName    string `json:"city_name"`
}

type HotelFilterParameters

type HotelFilterParameters struct {
	Limit     int    `form:"limit"`
	Offset    int    `form:"offset"`
	OrderBy   string `form:"order_by"`
	OrderType string `form:"order_type"`

	HotelName  string  `form:"hotel_name"`
	StarsFrom  int     `form:"stars_from"`
	StarsTo    int     `form:"stars_to"`
	RatingFrom float64 `form:"rating_from"`
	RatingTo   float64 `form:"rating_to"`
	PriceFrom  float64 `form:"price_from"`
	PriceTo    float64 `form:"price_to"`

	NearSea  bool   `form:"near_sea"`
	CityName string `form:"city_name"`
}

type PostgresRepository

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

func (PostgresRepository) CreateCityTour

func (db PostgresRepository) CreateCityTour(cityTour *CityTour) error

func (PostgresRepository) CreateCityTourEvent

func (db PostgresRepository) CreateCityTourEvent(cityTourEvent *CityToursEvent) error

func (PostgresRepository) CreateRestaurantBooking

func (db PostgresRepository) CreateRestaurantBooking(restaurantBooking *RestaurantBookingDTO) error

func (PostgresRepository) CreateTour

func (db PostgresRepository) CreateTour(tour *Tour) error

func (PostgresRepository) CreateUser

func (db PostgresRepository) CreateUser(user *User) error

func (PostgresRepository) DeleteCityTour

func (db PostgresRepository) DeleteCityTour(cityTourId int) error

func (PostgresRepository) DeleteRestaurantBooking

func (db PostgresRepository) DeleteRestaurantBooking(restaurantBookingId int) error

func (PostgresRepository) DeleteTour

func (db PostgresRepository) DeleteTour(tourId int) error

func (PostgresRepository) DeleteUser

func (db PostgresRepository) DeleteUser(userId int) error

func (PostgresRepository) GetCities

func (db PostgresRepository) GetCities() ([]City, error)

func (PostgresRepository) GetCityTours

func (db PostgresRepository) GetCityTours(tourId int) []CityTourData

func (PostgresRepository) GetEvent

func (db PostgresRepository) GetEvent(id int) (*Event, error)

func (PostgresRepository) GetEvents

func (PostgresRepository) GetHotel

func (db PostgresRepository) GetHotel(id int) (*Hotel, error)

func (PostgresRepository) GetHotels

func (db PostgresRepository) GetHotels(filter HotelFilterParameters) ([]HotelFeedItem, error)

func (PostgresRepository) GetRestaurant

func (db PostgresRepository) GetRestaurant(id int) (*Restaurant, error)

func (PostgresRepository) GetRestaurantBookings

func (db PostgresRepository) GetRestaurantBookings(cityTourId int) []RestaurantBookingData

func (PostgresRepository) GetRestaurants

func (PostgresRepository) GetTicket

func (db PostgresRepository) GetTicket(id int) (*Ticket, error)

func (PostgresRepository) GetTickets

func (PostgresRepository) GetTours

func (db PostgresRepository) GetTours(userId int) []TourData

func (PostgresRepository) GetUser

func (db PostgresRepository) GetUser(userId int) *UserData

func (PostgresRepository) GetUserByEmail

func (db PostgresRepository) GetUserByEmail(email string) *User

func (PostgresRepository) GetUserEvents

func (db PostgresRepository) GetUserEvents(cityTourId int) []EventData

func (PostgresRepository) GetUserHotel

func (db PostgresRepository) GetUserHotel(cityTourId int) *HotelData

func (PostgresRepository) GetUserPassword

func (db PostgresRepository) GetUserPassword(userId int) (string, error)

func (PostgresRepository) GetUserTickets

func (db PostgresRepository) GetUserTickets(cityTourId int) *CityTourTicketData

func (*PostgresRepository) Open

func (db *PostgresRepository) Open() error

func (PostgresRepository) UpdateCityTour

func (db PostgresRepository) UpdateCityTour(cityTour *CityTour) error

func (PostgresRepository) UpdateRestaurantBooking

func (db PostgresRepository) UpdateRestaurantBooking(restaurantBooking *RestaurantBooking) error

func (PostgresRepository) UpdateTour

func (db PostgresRepository) UpdateTour(tour *Tour) error

func (PostgresRepository) UpdateUser

func (db PostgresRepository) UpdateUser(user *User) error

type Repository

type Repository interface {
	Open() error

	CreateUser(user *User) error
	GetUserByEmail(email string) *User

	GetUser(userId int) *UserData
	GetUserPassword(userId int) (string, error)
	GetTours(userId int) []TourData
	GetCityTours(tourId int) []CityTourData

	GetUserEvents(cityTourId int) []EventData
	GetRestaurantBookings(cityTourId int) []RestaurantBookingData
	GetUserTickets(cityTourId int) *CityTourTicketData
	GetUserHotel(cityTourId int) *HotelData

	CreateTour(tour *Tour) error
	CreateCityTour(cityTour *CityTour) error
	CreateCityTourEvent(cityTourEvent *CityToursEvent) error
	CreateRestaurantBooking(restaurantBooking *RestaurantBookingDTO) error

	UpdateUser(user *User) error
	UpdateTour(tour *Tour) error
	UpdateCityTour(cityTour *CityTour) error
	UpdateRestaurantBooking(restaurantBooking *RestaurantBooking) error

	DeleteUser(userId int) error
	DeleteTour(tourId int) error
	DeleteCityTour(cityTourId int) error
	DeleteRestaurantBooking(restaurantBookingId int) error

	GetCities() ([]City, error)
	GetHotel(id int) (*Hotel, error)
	GetEvent(id int) (*Event, error)
	GetRestaurant(id int) (*Restaurant, error)
	GetTicket(id int) (*Ticket, error)

	GetHotels(filter HotelFilterParameters) ([]HotelFeedItem, error)
	GetEvents(filter EventsFilterParameters) ([]EventFeedItem, error)
	GetRestaurants(filter RestaurantFilterParameters) ([]RestaurantFeedItem, error)
	GetTickets(filter TicketFilterParameters) ([]TicketFeedItem, error)
	// contains filtered or unexported methods
}

func CreateRepository

func CreateRepository(conf config.DbConfig) Repository

type Restaurant

type Restaurant struct {
	RestaurantId int `json:"restaurant_id"`

	RestName        string `json:"restaurant_name"`
	RestDescription string `json:"restaurant_description"`
	RestAddr        string `json:"restaurant_addr"`

	AvgPrice   string  `json:"average_price"`
	RestRating float64 `json:"rating"`

	ChildMenu   bool `json:"child_menu"`
	SmokingRoom bool `json:"smoking_room"`

	CountryName string `json:"country_name"`
	CityName    string `json:"city_name"`
}

type RestaurantBooking

type RestaurantBooking struct {
	Id           int    `json:"id"`
	RestaurantId int    `json:"restaurant_id"`
	BookingTime  string `json:"booking_time"`
}

type RestaurantBookingDTO

type RestaurantBookingDTO struct {
	CtId         int    `json:"id"`
	RestaurantId int    `json:"restaurant_id"`
	BookingTime  string `json:"booking_time"`
}

type RestaurantBookingData

type RestaurantBookingData struct {
	Id           int `json:"restaurant_booking_id"`
	RestaurantId int `json:"restaurant_id"`

	BookingTime    string `json:"booking_time"`
	RestaurantName string `json:"restaurant_name"`

	AveragePrice string  `json:"average_price"`
	Rating       float64 `json:"rating"`
}

type RestaurantFeedItem

type RestaurantFeedItem struct {
	RestaurantId   int     `json:"restaurant_id"`
	RestaurantName string  `json:"restaurant_name"`
	Rating         float64 `json:"rating"`

	CountryName string `json:"country_name"`
	CityName    string `json:"city_name"`
}

type RestaurantFilterParameters

type RestaurantFilterParameters struct {
	Limit     int    `form:"limit"`
	Offset    int    `form:"offset"`
	OrderBy   string `form:"order_by"`
	OrderType string `form:"order_type"`

	RestaurantName string  `form:"restaurant_name"`
	RatingFrom     float64 `form:"rating_from"`
	RatingTo       float64 `form:"rating_to"`
	PriceFrom      float64 `form:"price_from"`
	PriceTo        float64 `form:"price_to"`

	ChildMenu   bool `form:"child_menu"`
	SmokingRoom bool `form:"smoking_room"`

	CityName string `form:"city_name"`
}

type Ticket

type Ticket struct {
	TicketId int `json:"ticket_id"`

	CompanyName   string  `json:"company_name"`
	CompanyRating float64 `json:"company_rating"`

	OrigStationName string `json:"orig_station_name"`
	OrigStationAddr string `json:"orig_station_addr"`
	OrigCountryName string `json:"orig_country_name"`
	OrigCityName    string `json:"orig_city_name"`

	DestStationName string `json:"dest_station_name"`
	DestStationAddr string `json:"dest_station_addr"`
	DestCityName    string `json:"dest_city_name"`
	DestCountryName string `json:"dest_country_name"`

	TransportType string `json:"transport_type"`
	Price         string `json:"price"`
	TicketDate    string `json:"ticket_date"`
}

type TicketData

type TicketData struct {
	Id            int    `json:"ticket_id"`
	TransportType string `json:"transport_type"`
	Price         string `json:"price"`
	Date          string `json:"date"`

	OrigCountryName string `json:"orig_country_name"`
	OrigCityName    string `json:"orig_city_name"`
	DestCountryName string `json:"dest_country_name"`
	DestCityName    string `json:"dest_city_name"`

	CompanyName   string  `json:"company_name"`
	CompanyRating float64 `json:"company_rating"`
}

type TicketFeedItem

type TicketFeedItem struct {
	TicketId      int    `json:"ticket_id"`
	TransportType string `json:"transport_type"`
	Price         string `json:"price"`
	Date          string `json:"date"`

	OrigCountryName string `json:"orig_country_name"`
	OrigCityName    string `json:"orig_city_name"`
	DestCountryName string `json:"dest_country_name"`
	DestCityName    string `json:"dest_city_name"`
}

type TicketFilterParameters

type TicketFilterParameters struct {
	Limit     int    `form:"limit"`
	Offset    int    `form:"offset"`
	OrderBy   string `form:"order_by"`
	OrderType string `form:"order_type"`

	TransportType string  `form:"transport_type"`
	DateFrom      string  `form:"date_from"`
	DateTo        string  `form:"date_to"`
	PriceFrom     float64 `form:"price_from"`
	PriceTo       float64 `form:"price_to"`

	OrigCityName string `form:"orig_city_name"`
	DestCityName string `form:"dest_city_name"`
}

type Tour

type Tour struct {
	Id     int `json:"id"`
	UserId int `json:"user_id"`

	TourName  string  `json:"tour_name"`
	TourPrice float64 `json:"tour_price"`

	TourDateFrom string `json:"tour_date_from"`
	TourDateTo   string `json:"tour_date_to"`
}

type TourData

type TourData struct {
	Id int `json:"tour_id"`

	TourName  string `json:"tour_name"`
	TourPrice string `json:"tour_price"`

	TourDateFrom string `json:"tour_date_from"`
	TourDateTo   string `json:"tour_date_to"`
}

type User

type User struct {
	Id       int    `json:"id"`
	Email    string `json:"email"`
	Password string `json:"password"`

	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`

	PhotoUrl string `json:"photo_url"`
}

type UserData

type UserData struct {
	Id        int    `json:"user_id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	PhotoUrl  string `json:"photo_url"`
}

Jump to

Keyboard shortcuts

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