Documentation
¶
Index ¶
- Variables
- func ConnectToDB()
- func SignUp(db *sql.DB, UserName, Email, Phone, AvatarUrl string, Role string, ...) (int, error)
- func UpdateLastActiveAt(db *sql.DB, userID int) error
- func UpdateUserAvatar(db *sql.DB, id int, avatarUrl string) error
- func UpdateUserData(db *sql.DB, userData *UserData) error
- func UpdateUserDescription(db *sql.DB, id int, description string) error
- func UpdateUserEmail(db *sql.DB, id int, email string) error
- func UpdateUserName(db *sql.DB, id int, userName string) error
- func UpdateUserPassword(db *sql.DB, id int, passwordHash string) error
- func UpdateUserPhone(db *sql.DB, id int, phone string) error
- func UpdateUserSkills(db *sql.DB, id int, skills string) error
- func UpdateUserStatus(db *sql.DB, id int, status string) error
- type Config
- type Config_db
- type Task
- type UserData
- type UserDataLoginResp
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DB *sql.DB
)
Functions ¶
func ConnectToDB ¶
func ConnectToDB()
func SignUp ¶
func SignUp(db *sql.DB, UserName, Email, Phone, AvatarUrl string, Role string, PasswordHash string, DateOfBirth string) (int, error)
Insert into users table Postgres does not support LastInsertId. Use Insert and return the ID by selecting it from the database.
func UpdateUserDescription ¶
Types ¶
type Task ¶
type Task struct { TaskID int TaskName string TaskDescription string SolutionCode string TestCases interface{} }
func GetAllTasks ¶
GetAllTasks retrieves all tasks from the database
type UserData ¶
type UserData struct { ID int `json:"id"` UserName string `json:"user_name"` Description string `json:"description"` Email string `json:"email"` Phone string `json:"phone"` AvatarUrl string `json:"avatar_url"` Status string `json:"status"` Role string `json:"role"` PasswordHash string `json:"password_hash"` DateOfBirth time.Time `json:"date_of_birth"` PrivacySettings string `json:"privacy_settings"` IsActive bool `json:"is_active"` LastLogin time.Time `json:"last_login"` ConfirmationToken string `json:"confirmation_token"` SocialProfiles string `json:"social_profiles"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type UserDataLoginResp ¶
type UserDataLoginResp struct { ID int `json:"id"` UserName string `json:"user_name"` Description string `json:"description"` Email string `json:"email"` Phone string `json:"phone"` AvatarUrl string `json:"avatar_url"` Status string `json:"status"` Role string `json:"role"` DateOfBirth time.Time `json:"date_of_birth"` PrivacySettings string `json:"privacy_settings"` IsActive bool `json:"is_active"` LastLogin time.Time `json:"last_login"` ConfirmationToken string `json:"confirmation_token"` SocialProfiles string `json:"social_profiles"` }
Click to show internal directories.
Click to hide internal directories.