Documentation
¶
Index ¶
- func IntConvert[From, To ...](src From) To
- func IntPtrConvert[From, To ~int | ~int32 | ~int64 | ~float32 | ~float64](src *From) *To
- func NullBoolToPtr(n sql.NullBool) *bool
- func NullBytesToPtr(b []byte) *[]byte
- func NullFloat64ToPtr(n sql.NullFloat64) *float64
- func NullInt32ToPtr(n sql.NullInt32) *int32
- func NullInt64ToPtr(n sql.NullInt64) *int64
- func NullStringToPtr(n sql.NullString) *string
- func NullTimeToProto(n sql.NullTime) *timestamppb.Timestamp
- func OptionalWithFallback[T any](val *T, fallback T) T
- func ProtoToNullTime(t *timestamppb.Timestamp) sql.NullTime
- func ProtoToTime(t *timestamppb.Timestamp) time.Time
- func PtrBytesToNullString(p *[]byte) sql.NullString
- func PtrToNullBool(p *bool) sql.NullBool
- func PtrToNullBytes(b *[]byte) []byte
- func PtrToNullFloat64(p *float64) sql.NullFloat64
- func PtrToNullInt32(p *int32) sql.NullInt32
- func PtrToNullInt64(p *int64) sql.NullInt64
- func PtrToNullString(p *string) sql.NullString
- func SQLiteBoolPtrToInt64Ptr(b *bool) *int64
- func SQLiteBoolToInt(b bool) int64
- func SQLiteInt64PtrToBoolPtr(i *int64) *bool
- func SQLiteIntToBool(i int64) bool
- func TimeToProto(t time.Time) *timestamppb.Timestamp
- type CreateBulkUserParams
- type CreateUserParams
- type DBTX
- type ListUserFilterByAgeNameParams
- type Queries
- func (q *Queries) CreateBulkUser(ctx context.Context, args []CreateBulkUserParams) ([]int32, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (int32, error)
- func (q *Queries) DeleteAllUser(ctx context.Context) error
- func (q *Queries) DeleteUser(ctx context.Context, id int32) error
- func (q *Queries) GetUserByEmail(ctx context.Context, email string) (*User, error)
- func (q *Queries) GetUserByID(ctx context.Context, id int32) (*User, error)
- func (q *Queries) ListActive(ctx context.Context, isActive bool) ([]*User, error)
- func (q *Queries) ListAllUser(ctx context.Context) ([]*User, error)
- func (q *Queries) ListUserFilterByAgeName(ctx context.Context, arg ListUserFilterByAgeNameParams) ([]*User, error)
- func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (*User, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type UpdateUserParams
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IntConvert ¶
func IntPtrConvert ¶
example: IntPtrConvert[int64, int32](dbRow.Age)
func NullBoolToPtr ¶
func NullFloat64ToPtr ¶
func NullFloat64ToPtr(n sql.NullFloat64) *float64
func NullInt32ToPtr ¶
--- Nullable SQL Type Converters ---
func NullInt64ToPtr ¶
func NullStringToPtr ¶
func NullStringToPtr(n sql.NullString) *string
func NullTimeToProto ¶
func NullTimeToProto(n sql.NullTime) *timestamppb.Timestamp
--- Time Converters ---
func OptionalWithFallback ¶
func OptionalWithFallback[T any](val *T, fallback T) T
OptionalWithFallback chooses fallback if optional value is nil
func ProtoToNullTime ¶
func ProtoToNullTime(t *timestamppb.Timestamp) sql.NullTime
func ProtoToTime ¶
func ProtoToTime(t *timestamppb.Timestamp) time.Time
Note: If the pointer is nil, it returns a zero time.Time{}
func PtrBytesToNullString ¶
func PtrBytesToNullString(p *[]byte) sql.NullString
PtrBytesToNullString converts *[]byte to sql.NullString for MySQL compatibility
func PtrToNullBool ¶
func PtrToNullBytes ¶
func PtrToNullFloat64 ¶
func PtrToNullFloat64(p *float64) sql.NullFloat64
func PtrToNullInt32 ¶
func PtrToNullInt64 ¶
func PtrToNullString ¶
func PtrToNullString(p *string) sql.NullString
func SQLiteBoolPtrToInt64Ptr ¶
SQLiteBoolPtrToInt64Ptr converts an optional bool to an optional SQLite int64 (used for nullable columns via sqlc.narg, e.g. *bool -> *int64).
func SQLiteBoolToInt ¶
func SQLiteInt64PtrToBoolPtr ¶
SQLiteInt64PtrToBoolPtr is the inverse of SQLiteBoolPtrToInt64Ptr.
func TimeToProto ¶
func TimeToProto(t time.Time) *timestamppb.Timestamp
TimeToProto converts time.Time to timestamppb.Timestamp pointer
Types ¶
type CreateBulkUserParams ¶
type CreateBulkUserParams struct {
Email string `json:"email"`
Name string `json:"name"`
Age *int32 `json:"age"`
Password string `json:"password"`
ApiKey *[]byte `json:"api_key"`
IsActive *bool `json:"is_active"`
LoginCount *int64 `json:"login_count"`
Rating *float64 `json:"rating"`
Preferences *string `json:"preferences"`
}
type CreateUserParams ¶
type CreateUserParams struct {
Email string `json:"email"`
Name string `json:"name"`
Age *int32 `json:"age"`
Password string `json:"password"`
ApiKey *[]byte `json:"api_key"`
IsActive *bool `json:"is_active"`
LoginCount *int64 `json:"login_count"`
Rating *float64 `json:"rating"`
Preferences *string `json:"preferences"`
}
type Queries ¶
func (*Queries) CreateBulkUser ¶
func (*Queries) CreateUser ¶
func (*Queries) GetUserByEmail ¶
func (*Queries) GetUserByID ¶
func (*Queries) ListActive ¶
func (*Queries) ListUserFilterByAgeName ¶
func (*Queries) UpdateUser ¶
type UpdateUserParams ¶
type UpdateUserParams struct {
Email string `json:"email"`
Name string `json:"name"`
Age *int32 `json:"age"`
Password *string `json:"password"`
IsActive *bool `json:"is_active"`
LoginCount *int64 `json:"login_count"`
Rating *float64 `json:"rating"`
Preferences *string `json:"preferences"`
ID int32 `json:"id"`
}
type User ¶
type User struct {
ID int32 `json:"ID"`
Email string `json:"email"`
Name string `json:"name"`
Age *int32 `json:"age"`
Password string `json:"password"`
ApiKey []byte `json:"api_key"`
IsActive bool `json:"is_active"`
LoginCount int64 `json:"login_count"`
Rating float64 `json:"rating"`
Preferences string `json:"preferences"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func UserFromSQL ¶
Click to show internal directories.
Click to hide internal directories.