user

package
v0.0.0-...-b0fceeb Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOrderRequest

type CreateOrderRequest struct {
	OrderID  string `json:"order_id"`
	OrderQty int    `json:"order_qty"`
	Amount   string `json:"amount"`
}

CreateOrderRequest represents a request to create a new order

type CreateUserRequest

type CreateUserRequest struct {
	UserID string `json:"user_id"`
	Email  string `json:"email"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

CreateUserRequest represents a request to create a new user

type Order

type Order struct {
	OrderID   string    `json:"order_id"`
	OrderQty  int       `json:"order_qty"`
	Amount    string    `json:"amount"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Order represents an order (keeping existing functionality)

func (*Order) FromOrder

func (o *Order) FromOrder(ctx context.Context, in *ordersDataStore.Order) *Order

FromOrder converts from sqlc generated type to domain Order type

type OrderDataStore

type OrderDataStore interface {
	CreateOrder(ctx context.Context, arg CreateOrderRequest) error
	GetAllOrders(ctx context.Context) ([]*Order, error)
	GetOrderByID(ctx context.Context, orderID string) (*Order, error)
}

OrderDataStore interface defines operations for orders (keeping existing functionality)

type UpdateUserRequest

type UpdateUserRequest struct {
	Email  string `json:"email,omitempty"`
	Name   string `json:"name,omitempty"`
	Status string `json:"status,omitempty"`
}

UpdateUserRequest represents a request to update an existing user

type User

type User struct {
	UserID    string    `json:"user_id"`
	Email     string    `json:"email"`
	Name      string    `json:"name"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

User represents a user in the system

func (*User) FromOrder

func (u *User) FromOrder(ctx context.Context, in *ordersDataStore.Order) *User

FromOrder converts from sqlc generated Order type to domain User type Note: This assumes the orders table is being used for users (common in examples)

func (*User) FromOrderRO

func (u *User) FromOrderRO(ctx context.Context, in *orderRoDataStore.Order) *User

FromOrderRO converts from sqlc generated RO Order type to domain User type

type UserDataStore

type UserDataStore interface {
	// Write operations (use RW connection)
	CreateUser(ctx context.Context, arg CreateUserRequest) error
	UpdateUser(ctx context.Context, userID string, arg UpdateUserRequest) error
	DeleteUser(ctx context.Context, userID string) error

	// Read operations (use RO connection)
	GetUserByID(ctx context.Context, userID string) (*User, error)
	GetAllUsers(ctx context.Context) ([]*User, error)
}

UserDataStore interface defines all operations for users (both read and write)

func NewUserDataStore

func NewUserDataStore(
	cf gox.CrossFunction,
	rwQuerier ordersDataStore.Querier,
	rwQueries *ordersDataStore.Queries,
	roQuerier orderRoDataStore.Querier,
	roQueries *orderRoDataStore.Queries,
) UserDataStore

Constructor functions

Jump to

Keyboard shortcuts

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