database

package
v0.0.0-...-dbfe939 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMessageParams

type CreateMessageParams struct {
	ID       uuid.UUID
	Content  string
	SenderID uuid.UUID
	RoomID   uuid.UUID
}

type CreateRoomParams

type CreateRoomParams struct {
	ID        uuid.UUID
	Name      string
	CreatorID uuid.UUID
	OwnerID   uuid.UUID
}

type CreateUserParams

type CreateUserParams struct {
	ID       uuid.UUID
	Username string
	Password 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 GetMessagesByRoomAndUserParams

type GetMessagesByRoomAndUserParams struct {
	RoomID   uuid.UUID
	SenderID uuid.UUID
}

type GetMessagesByRoomRow

type GetMessagesByRoomRow struct {
	ID        uuid.UUID
	Content   string
	CreatedAt time.Time
	UpdatedAt time.Time
	SenderID  uuid.UUID
	RoomID    uuid.UUID
	Username  string
}

type GetMessagesByUserRow

type GetMessagesByUserRow struct {
	ID        uuid.UUID
	Content   string
	CreatedAt time.Time
	UpdatedAt time.Time
	SenderID  uuid.UUID
	RoomID    uuid.UUID
	Username  string
}

type GetPreviousRoomMessagesParams

type GetPreviousRoomMessagesParams struct {
	RoomID uuid.UUID
	Limit  int32
}

type GetPreviousRoomMessagesRow

type GetPreviousRoomMessagesRow struct {
	ID        uuid.UUID
	Content   string
	CreatedAt time.Time
	UpdatedAt time.Time
	SenderID  uuid.UUID
	RoomID    uuid.UUID
	Username  string
}

type Message

type Message struct {
	ID        uuid.UUID
	Content   string
	CreatedAt time.Time
	UpdatedAt time.Time
	SenderID  uuid.UUID
	RoomID    uuid.UUID
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateMessage

func (q *Queries) CreateMessage(ctx context.Context, arg CreateMessageParams) (Message, error)

func (*Queries) CreateRoom

func (q *Queries) CreateRoom(ctx context.Context, arg CreateRoomParams) (Room, error)

func (*Queries) CreateUser

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

func (*Queries) DeleteUserById

func (q *Queries) DeleteUserById(ctx context.Context, id uuid.UUID) (int64, error)

func (*Queries) FindAllRooms

func (q *Queries) FindAllRooms(ctx context.Context) ([]Room, error)

func (*Queries) FindRoomById

func (q *Queries) FindRoomById(ctx context.Context, id uuid.UUID) (Room, error)

func (*Queries) FindUserByApiKey

func (q *Queries) FindUserByApiKey(ctx context.Context, apiKey string) (User, error)

func (*Queries) FindUserById

func (q *Queries) FindUserById(ctx context.Context, id uuid.UUID) (User, error)

func (*Queries) FindUserByUsername

func (q *Queries) FindUserByUsername(ctx context.Context, username string) (User, error)

func (*Queries) GetMessagesByRoom

func (q *Queries) GetMessagesByRoom(ctx context.Context, roomID uuid.UUID) ([]GetMessagesByRoomRow, error)

func (*Queries) GetMessagesByRoomAndUser

func (q *Queries) GetMessagesByRoomAndUser(ctx context.Context, arg GetMessagesByRoomAndUserParams) ([]Message, error)

func (*Queries) GetMessagesByUser

func (q *Queries) GetMessagesByUser(ctx context.Context, senderID uuid.UUID) ([]GetMessagesByUserRow, error)

func (*Queries) GetPreviousRoomMessages

func (q *Queries) GetPreviousRoomMessages(ctx context.Context, arg GetPreviousRoomMessagesParams) ([]GetPreviousRoomMessagesRow, error)

func (*Queries) WithTx

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

type Room

type Room struct {
	ID        uuid.UUID
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
	CreatorID uuid.UUID
	OwnerID   uuid.UUID
}

type User

type User struct {
	ID        uuid.UUID
	Username  string
	Password  string
	CreatedAt time.Time
	UpdatedAt time.Time
	ApiKey    string
}

Jump to

Keyboard shortcuts

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