types

package
v0.0.0-...-8e87c78 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSuccessMessage

func GetSuccessMessage(r *http.Request) string

func WriteErrorResponse

func WriteErrorResponse(w http.ResponseWriter, message string, code int)

func WriteSuccessResponse

func WriteSuccessResponse(w http.ResponseWriter, message string, data any)

Types

type ErrorResponse

type ErrorResponse struct {
	Status  string `json:"status" bson:"status"`
	Message string `json:"message" bson:"message"`
	Code    int    `json:"code" bson:"code"`
}

type Host

type Host struct {
	HostId       int       `json:"host_id" bson:"host_id"`
	HostUsername string    `json:"host_username" bson:"host_username"`
	Password     string    `json:"host_password,omitempty" bson:"host_password"`
	IsVerified   bool      `json:"is_verified" bson:"is_verified"`
	Description  string    `json:"description" bson:"description"`
	CreatedAt    time.Time `json:"created_at" bson:"created_at"`
}

func BodyToHost

func BodyToHost(body []byte) (*Host, error)

type Room

type Room struct {
	RoomId       int       `json:"room_id" bson:"room_id"`
	UserOwner    int       `json:"user_owner,omitempty" bson:"user_owner"`
	AssignedHost int       `json:"assigned_host,omitempty" bson:"assigned_host"`
	RoomCode     string    `json:"room_code,omitempty" bson:"room_code"`
	StartDate    time.Time `json:"start_date,omitempty" bson:"start_date"`
	EndDate      time.Time `json:"end_date,omitempty" bson:"end_date"`
}

func BodyToRoom

func BodyToRoom(body []byte) (*Room, error)

type SuccessResponse

type SuccessResponse struct {
	Status  string `json:"status" bson:"status"`
	Message string `json:"message" bson:"message"`
	Data    any    `json:"data,omitempty" bson:"data"`
}

type User

type User struct {
	UserId     int       `json:"user_id" bson:"user_id"`
	Email      string    `json:"email" bson:"email"`
	Password   string    `json:"password,omitempty" bson:"password"`
	CreatedAt  time.Time `json:"created_at" bson:"created_at"`
	UserHandle string    `json:"user_handle" bson:"user_handle"`
}

func BodyToUser

func BodyToUser(body []byte) (*User, error)

Jump to

Keyboard shortcuts

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