sqlc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 3 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              string         `json:"id"`
	Room            string         `json:"room"`
	User            string         `json:"user"`
	Content         string         `json:"content"`
	Timestamp       time.Time      `json:"timestamp"`
	Signature       sql.NullString `json:"signature"`
	Pubkey          sql.NullString `json:"pubkey"`
	SignedTimestamp sql.NullInt64  `json:"signed_timestamp"`
}

type CreateRoomParams

type CreateRoomParams struct {
	Name         string         `json:"name"`
	PasswordHash sql.NullString `json:"password_hash"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
}

type CreateUserParams

type CreateUserParams struct {
	PublicKey string    `json:"public_key"`
	Verified  bool      `json:"verified"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

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 GetMessagesByRoomPaginatedParams

type GetMessagesByRoomPaginatedParams struct {
	Room      string    `json:"room"`
	Timestamp time.Time `json:"timestamp"`
	Limit     int64     `json:"limit"`
}

type GetRoomsWithLasMessageRow

type GetRoomsWithLasMessageRow struct {
	Name                 string `json:"name"`
	HasPassword          int64  `json:"has_password"`
	LastMessageContent   string `json:"last_message_content"`
	LastMessageUser      string `json:"last_message_user"`
	LastMessageTimestamp string `json:"last_message_timestamp"`
}

type GetUserWithPostCountRow

type GetUserWithPostCountRow struct {
	PublicKey string      `json:"public_key"`
	Verified  bool        `json:"verified"`
	CreatedAt time.Time   `json:"created_at"`
	UpdatedAt time.Time   `json:"updated_at"`
	PostCount interface{} `json:"post_count"`
}

type Message

type Message struct {
	ID              string         `json:"id"`
	Room            string         `json:"room"`
	User            string         `json:"user"`
	Content         string         `json:"content"`
	Timestamp       time.Time      `json:"timestamp"`
	Signature       sql.NullString `json:"signature"`
	Pubkey          sql.NullString `json:"pubkey"`
	SignedTimestamp sql.NullInt64  `json:"signed_timestamp"`
}

type Querier

type Querier interface {
	CreateMessage(ctx context.Context, arg CreateMessageParams) (Message, error)
	CreateRoom(ctx context.Context, arg CreateRoomParams) (Room, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	GetAllUsers(ctx context.Context) ([]User, error)
	GetMessageCountByRoom(ctx context.Context, room string) (int64, error)
	GetMessagesByRoomPaginated(ctx context.Context, arg GetMessagesByRoomPaginatedParams) ([]Message, error)
	GetRoomByName(ctx context.Context, name string) (Room, error)
	GetRoomPasswordHash(ctx context.Context, name string) (sql.NullString, error)
	GetRoomsWithLasMessage(ctx context.Context) ([]GetRoomsWithLasMessageRow, error)
	GetUserByPublicKey(ctx context.Context, publicKey string) (User, error)
	GetUserVerified(ctx context.Context, publicKey string) (bool, error)
	GetUserWithPostCount(ctx context.Context, publicKey string) (GetUserWithPostCountRow, error)
	RoomExists(ctx context.Context, name string) (bool, error)
	SearchRoomsByName(ctx context.Context, dollar_1 sql.NullString) ([]SearchRoomsByNameRow, error)
	UpdateUserVerified(ctx context.Context, arg UpdateUserVerifiedParams) error
	UserExistsByPublicKey(ctx context.Context, publicKey string) (bool, error)
}

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) GetAllUsers

func (q *Queries) GetAllUsers(ctx context.Context) ([]User, error)

func (*Queries) GetMessageCountByRoom

func (q *Queries) GetMessageCountByRoom(ctx context.Context, room string) (int64, error)

func (*Queries) GetMessagesByRoomPaginated

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

func (*Queries) GetRoomByName

func (q *Queries) GetRoomByName(ctx context.Context, name string) (Room, error)

func (*Queries) GetRoomPasswordHash

func (q *Queries) GetRoomPasswordHash(ctx context.Context, name string) (sql.NullString, error)

func (*Queries) GetRoomsWithLasMessage

func (q *Queries) GetRoomsWithLasMessage(ctx context.Context) ([]GetRoomsWithLasMessageRow, error)

func (*Queries) GetUserByPublicKey

func (q *Queries) GetUserByPublicKey(ctx context.Context, publicKey string) (User, error)

func (*Queries) GetUserVerified

func (q *Queries) GetUserVerified(ctx context.Context, publicKey string) (bool, error)

func (*Queries) GetUserWithPostCount

func (q *Queries) GetUserWithPostCount(ctx context.Context, publicKey string) (GetUserWithPostCountRow, error)

func (*Queries) RoomExists

func (q *Queries) RoomExists(ctx context.Context, name string) (bool, error)

func (*Queries) SearchRoomsByName

func (q *Queries) SearchRoomsByName(ctx context.Context, dollar_1 sql.NullString) ([]SearchRoomsByNameRow, error)

func (*Queries) UpdateUserVerified

func (q *Queries) UpdateUserVerified(ctx context.Context, arg UpdateUserVerifiedParams) error

func (*Queries) UserExistsByPublicKey

func (q *Queries) UserExistsByPublicKey(ctx context.Context, publicKey string) (bool, error)

func (*Queries) WithTx

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

type Room

type Room struct {
	Name         string         `json:"name"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
	PasswordHash sql.NullString `json:"password_hash"`
}

type SearchRoomsByNameRow

type SearchRoomsByNameRow struct {
	Name                 string `json:"name"`
	HasPassword          int64  `json:"has_password"`
	LastMessageContent   string `json:"last_message_content"`
	LastMessageUser      string `json:"last_message_user"`
	LastMessageTimestamp string `json:"last_message_timestamp"`
}

type UpdateUserVerifiedParams

type UpdateUserVerifiedParams struct {
	Verified  bool      `json:"verified"`
	UpdatedAt time.Time `json:"updated_at"`
	PublicKey string    `json:"public_key"`
}

type User

type User struct {
	PublicKey string    `json:"public_key"`
	Verified  bool      `json:"verified"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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