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 Audit
- type CreateAuditParams
- type CreateMatchParams
- type CreatePlayerParams
- type DBTX
- type Match
- type Player
- type Queries
- func (q *Queries) CreateAudit(ctx context.Context, arg CreateAuditParams) (int32, error)
- func (q *Queries) CreateMatch(ctx context.Context, arg CreateMatchParams) (int32, error)
- func (q *Queries) CreatePlayer(ctx context.Context, arg CreatePlayerParams) error
- func (q *Queries) DeleteAllMatch(ctx context.Context) error
- func (q *Queries) DeleteMatch(ctx context.Context, id int32) error
- func (q *Queries) GetMatchById(ctx context.Context, id int32) (*Match, error)
- func (q *Queries) GetPlayerByName(ctx context.Context, name string) (*Player, error)
- func (q *Queries) ListAllAudit(ctx context.Context) ([]*Audit, error)
- func (q *Queries) ListAllMatch(ctx context.Context) ([]*Match, error)
- func (q *Queries) ListAllPlayer(ctx context.Context) ([]*Player, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
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
A nil pointer 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 *bool to *int64 for nullable columns via sqlc.narg
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 Audit ¶
type Audit struct {
ID int32 `json:"id"`
Action string `json:"action"`
MatchID int32 `json:"match_id"`
Detail string `json:"detail"`
CreatedAt time.Time `json:"created_at"`
}
func AuditFromSQL ¶
func (*Audit) AuditToSQL ¶
type CreateAuditParams ¶
type CreateMatchParams ¶
type CreatePlayerParams ¶ added in v0.0.3
type Match ¶
type Match struct {
ID int32 `json:"id"`
White string `json:"white"`
Black string `json:"black"`
Result string `json:"result"`
Opening *string `json:"opening"`
Moves int32 `json:"moves"`
PlayedAt time.Time `json:"played_at"`
CreatedAt time.Time `json:"created_at"`
}
func MatchFromSQL ¶
func (*Match) MatchToSQL ¶
type Player ¶ added in v0.0.3
type Player struct {
Name string `json:"name"`
Rating int32 `json:"rating"`
Title *string `json:"title"`
JoinedAt time.Time `json:"joined_at"`
}
func PlayerFromSQL ¶ added in v0.0.3
func (*Player) PlayerToSQL ¶ added in v0.0.3
type Queries ¶
func (*Queries) CreateAudit ¶
func (*Queries) CreateMatch ¶
func (*Queries) CreatePlayer ¶ added in v0.0.3
func (q *Queries) CreatePlayer(ctx context.Context, arg CreatePlayerParams) error
func (*Queries) DeleteAllMatch ¶ added in v0.0.3
func (*Queries) GetMatchById ¶ added in v0.0.6
func (*Queries) GetPlayerByName ¶ added in v0.0.5
func (*Queries) ListAllAudit ¶
func (*Queries) ListAllMatch ¶
func (*Queries) ListAllPlayer ¶ added in v0.0.3
Click to show internal directories.
Click to hide internal directories.