// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.20.0 // source: users.sql package db import ( "context" "database/sql" ) const createUser = `-- name: CreateUser :one INSERT INTO users ( username, password ) VALUES ($1, $2) RETURNING id, email, username, password, avatar_picture, google_sign_in_payload, banned_at, banned_until, ban_reason, is_permaban, is_admin, is_critics, is_verified, social_media, created_at, updated_at ` type CreateUserParams struct { Username string `json:"username"` Password string `json:"password"` } func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) { row := q.db.QueryRowContext(ctx, createUser, arg.Username, arg.Password) var i User err := row.Scan( &i.ID, &i.Email, &i.Username, &i.Password, &i.AvatarPicture, &i.GoogleSignInPayload, &i.BannedAt, &i.BannedUntil, &i.BanReason, &i.IsPermaban, &i.IsAdmin, &i.IsCritics, &i.IsVerified, &i.SocialMedia, &i.CreatedAt, &i.UpdatedAt, ) return i, err } const updatePassword = `-- name: UpdatePassword :exec UPDATE users SET password = $1 WHERE id = $2 ` type UpdatePasswordParams struct { Password string `json:"password"` ID int32 `json:"id"` } func (q *Queries) UpdatePassword(ctx context.Context, arg UpdatePasswordParams) error { _, err := q.db.ExecContext(ctx, updatePassword, arg.Password, arg.ID) return err } const updateUser = `-- name: UpdateUser :one UPDATE users SET email = COALESCE($1, email), username = COALESCE($2, username), avatar_picture = COALESCE($3, avatar_picture) WHERE id = $4 RETURNING id, email, username, password, avatar_picture, google_sign_in_payload, banned_at, banned_until, ban_reason, is_permaban, is_admin, is_critics, is_verified, social_media, created_at, updated_at ` type UpdateUserParams struct { Email sql.NullString `json:"email"` Username sql.NullString `json:"username"` AvatarPicture sql.NullString `json:"avatar_picture"` ID int32 `json:"id"` } func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error) { row := q.db.QueryRowContext(ctx, updateUser, arg.Email, arg.Username, arg.AvatarPicture, arg.ID, ) var i User err := row.Scan( &i.ID, &i.Email, &i.Username, &i.Password, &i.AvatarPicture, &i.GoogleSignInPayload, &i.BannedAt, &i.BannedUntil, &i.BanReason, &i.IsPermaban, &i.IsAdmin, &i.IsCritics, &i.IsVerified, &i.SocialMedia, &i.CreatedAt, &i.UpdatedAt, ) return i, err }