database

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

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateReservationParams

type CreateReservationParams struct {
	Name         string
	PartySize    int32
	Time         time.Time
	RestaurantID int32
	TableID      int32
	UserID       int32
}

type CreateRestaurantParams

type CreateRestaurantParams struct {
	Name                string
	DietaryRestrictions []string
}

type CreateRestaurantTableParams

type CreateRestaurantTableParams struct {
	RestaurantID int32
	Capacity     int32
}

type CreateUserParams

type CreateUserParams struct {
	FirstName   string
	LastName    string
	PhoneNumber string
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetReservationsByUserIdRow

type GetReservationsByUserIdRow struct {
	UserID       int32
	RestaurantID int32
	Time         time.Time
}

type GetRestaurantsByDietaryRestrictionsAndTableCapacityParams

type GetRestaurantsByDietaryRestrictionsAndTableCapacityParams struct {
	Capacity            int32
	DietaryRestrictions []string
}

type GetRestaurantsByDietaryRestrictionsAndTableCapacityRow

type GetRestaurantsByDietaryRestrictionsAndTableCapacityRow struct {
	ID                  int32
	Capacity            int32
	RestaurantID        int32
	Name                sql.NullString
	DietaryRestrictions []string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateReservation

func (q *Queries) CreateReservation(ctx context.Context, arg CreateReservationParams) (Reservation, error)

func (*Queries) CreateRestaurant

func (q *Queries) CreateRestaurant(ctx context.Context, arg CreateRestaurantParams) (Restaurant, error)

func (*Queries) CreateRestaurantTable

func (q *Queries) CreateRestaurantTable(ctx context.Context, arg CreateRestaurantTableParams) (Table, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) DeleteReservation

func (q *Queries) DeleteReservation(ctx context.Context, id int32) (Reservation, error)

func (*Queries) GetReservationsByUserId

func (q *Queries) GetReservationsByUserId(ctx context.Context, userID int32) ([]GetReservationsByUserIdRow, error)

func (*Queries) GetRestaurants

func (q *Queries) GetRestaurants(ctx context.Context) ([]Restaurant, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Reservation

type Reservation struct {
	ID           int32
	Name         string
	PartySize    int32
	Time         time.Time
	RestaurantID int32
	TableID      int32
	UserID       int32
	IsActive     bool
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type Restaurant

type Restaurant struct {
	ID                  int32
	Name                string
	DietaryRestrictions []string
	CreatedAt           time.Time
	UpdatedAt           time.Time
}

type Table

type Table struct {
	ID           int32
	Capacity     int32
	IsReserved   bool
	RestaurantID int32
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type User

type User struct {
	ID          int32
	FirstName   string
	LastName    string
	PhoneNumber string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

Jump to

Keyboard shortcuts

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