store

package
v0.0.0-...-7e7321d Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MongoDBURL, MongoDBNAME, MongoTestDBNAME string
)

Functions

This section is empty.

Types

type BookingStore

type BookingStore interface {
	GetBookingByID(context.Context, string) (*types.Booking, error)
	GetBookings(context.Context, bson.M) ([]*types.Booking, error)
	InsertBooking(context.Context, *types.Booking) (*types.Booking, error)
	UpdateBooking(context.Context, string, bson.M) error

	Dropper
}

type Dropper

type Dropper interface {
	Drop(context.Context) error
}

type HotelStore

type HotelStore interface {
	GetHotelByID(context.Context, string) (*types.Hotel, error)
	GetHotels(context.Context, *options.FindOptions) ([]*types.Hotel, error)
	InsertHotel(context.Context, *types.Hotel) (*types.Hotel, error)
	InsertHotelRoom(context.Context, *types.Room) error
	UpdateHotel(context.Context, string, *types.UpdateHotelParams) error
	DeleteHotel(context.Context, string) error

	Dropper
}

type MongoBookingStore

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

func NewMongoBookingStore

func NewMongoBookingStore(client *mongo.Client, dbname string) *MongoBookingStore

func (*MongoBookingStore) Drop

func (s *MongoBookingStore) Drop(ctx context.Context) error

func (*MongoBookingStore) GetBookingByID

func (s *MongoBookingStore) GetBookingByID(ctx context.Context, id string) (*types.Booking, error)

func (*MongoBookingStore) GetBookings

func (s *MongoBookingStore) GetBookings(ctx context.Context, filter bson.M) ([]*types.Booking, error)

func (*MongoBookingStore) InsertBooking

func (s *MongoBookingStore) InsertBooking(ctx context.Context, room *types.Booking) (*types.Booking, error)

func (*MongoBookingStore) UpdateBooking

func (s *MongoBookingStore) UpdateBooking(ctx context.Context, id string, update bson.M) error

type MongoHotelStore

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

func (*MongoHotelStore) DeleteHotel

func (s *MongoHotelStore) DeleteHotel(ctx context.Context, id string) error

func (*MongoHotelStore) Drop

func (s *MongoHotelStore) Drop(ctx context.Context) error

func (*MongoHotelStore) GetHotelByID

func (s *MongoHotelStore) GetHotelByID(ctx context.Context, id string) (*types.Hotel, error)

func (*MongoHotelStore) GetHotels

func (s *MongoHotelStore) GetHotels(ctx context.Context, opts *options.FindOptions) ([]*types.Hotel, error)

func (*MongoHotelStore) InsertHotel

func (s *MongoHotelStore) InsertHotel(ctx context.Context, hotel *types.Hotel) (*types.Hotel, error)

func (*MongoHotelStore) InsertHotelRoom

func (s *MongoHotelStore) InsertHotelRoom(ctx context.Context, room *types.Room) error

func (*MongoHotelStore) UpdateHotel

func (s *MongoHotelStore) UpdateHotel(ctx context.Context, id string, params *types.UpdateHotelParams) error

type MongoRoomStore

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

func (*MongoRoomStore) Drop

func (s *MongoRoomStore) Drop(ctx context.Context) error

func (*MongoRoomStore) GetRooms

func (s *MongoRoomStore) GetRooms(ctx context.Context, id string) ([]*types.Room, error)

func (*MongoRoomStore) InsertRoom

func (s *MongoRoomStore) InsertRoom(ctx context.Context, room *types.Room) (*types.Room, error)

type MongoUserStore

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

func (*MongoUserStore) DeleteUser

func (s *MongoUserStore) DeleteUser(ctx context.Context, id string) error

func (*MongoUserStore) Drop

func (s *MongoUserStore) Drop(ctx context.Context) error

func (*MongoUserStore) GetUserByEmail

func (s *MongoUserStore) GetUserByEmail(ctx context.Context, email string) (*types.User, error)

func (*MongoUserStore) GetUserByID

func (s *MongoUserStore) GetUserByID(ctx context.Context, id string) (*types.User, error)

func (*MongoUserStore) GetUsers

func (s *MongoUserStore) GetUsers(ctx context.Context) ([]*types.User, error)

func (*MongoUserStore) InsertUser

func (s *MongoUserStore) InsertUser(ctx context.Context, user *types.User) (*types.User, error)

func (*MongoUserStore) UpdateUser

func (s *MongoUserStore) UpdateUser(ctx context.Context, id string, params *types.UpdateUserParams) error

type RoomStore

type RoomStore interface {
	GetRooms(context.Context, string) ([]*types.Room, error)
	InsertRoom(context.Context, *types.Room) (*types.Room, error)

	Dropper
}

type Store

type Store struct {
	User    UserStore
	Hotel   HotelStore
	Room    RoomStore
	Booking BookingStore
}

func NewMongoStore

func NewMongoStore(client *mongo.Client, dbname string) *Store

type UserStore

type UserStore interface {
	GetUserByID(context.Context, string) (*types.User, error)
	GetUserByEmail(context.Context, string) (*types.User, error)
	GetUsers(context.Context) ([]*types.User, error)
	InsertUser(context.Context, *types.User) (*types.User, error)
	UpdateUser(context.Context, string, *types.UpdateUserParams) error
	DeleteUser(context.Context, string) error

	Dropper
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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