model

package
v0.0.0-...-277ce5e Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package model contains data structures representing core domain entities, such as transactions and users, used throughout the wallet service.

Package model contains the data structures and functions related to users in the wallet system. It includes the User struct and methods for managing user-related operations such as balance, status, and contact information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transaction

type Transaction struct {
	ID                int             `json:"id" db:"id"`                                     // Transaction ID
	FromUserID        int             `json:"from_user_id" db:"from_user_id"`                 // The user ID of the transaction initiator
	ToUserID          int             `json:"to_user_id,omitempty" db:"to_user_id"`           // The user ID of the transaction recipient, 0 for deposits and withdrawals, used only for transfers
	Amount            decimal.Decimal `json:"amount" db:"amount"`                             // The transaction amount
	TransactionType   string          `json:"transaction_type" db:"transaction_type"`         // The transaction type, such as deposit, withdraw, transfer
	TransactionStatus string          `json:"transaction_status" db:"transaction_status"`     // The transaction status, such as completed, failed
	TransactionFee    decimal.Decimal `json:"transaction_fee,omitempty" db:"transaction_fee"` // The transaction fee, currently set to 0.0, with potential for future expansion
	PaymentMethod     string          `json:"payment_method" db:"payment_method"`             // The payment method, such as credit_card, bank_transfer, paypal, etc.
	CreatedAt         time.Time       `json:"created_at" db:"created_at"`                     // Creation time
	UpdatedAt         time.Time       `json:"updated_at" db:"updated_at"`                     // Update time
}

Transaction represents a financial transaction between users, including details such as the transaction ID, type, amount, status, and payment method. It supports deposit, withdrawal, and transfer types.

type User

type User struct {
	ID        int             `json:"id" db:"id"`                 // User ID
	Name      string          `json:"name" db:"name"`             // User name
	Email     string          `json:"email" db:"email"`           // User email
	Phone     string          `json:"phone" db:"phone"`           // User Phone
	Balance   decimal.Decimal `json:"balance" db:"balance"`       // User balance
	CreatedAt time.Time       `json:"created_at" db:"created_at"` // Creation time
	UpdatedAt time.Time       `json:"updated_at" db:"updated_at"` // Update time
	Status    string          `json:"status" db:"status"`         // User status, such as active, inactive, suspended
}

User represents a system user with personal details such as name, email, phone, balance, and account status. It also contains timestamps for creation and last update.

Jump to

Keyboard shortcuts

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