Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SliceToStr ¶
SliceToStr lets us print slices for debug purposes, and know if they are nil or not
Types ¶
type AccountCompatible ¶
type AccountCompatible struct { ID uint64 `json:"id" db:"id" ksql:"id"` Name string `json:"name" db:"name" ksql:"name"` Email string `json:"email" db:"email" ksql:"email"` Active bool `json:"active" db:"active" ksql:"active"` FavColor *string `json:"fav_color" db:"fav_color" ksql:"fav_color"` // Can be null // Could also use sql.NullString or Nullable instead of *string FavNumbers Array[int] `json:"fav_numbers" db:"fav_numbers" ksql:"fav_numbers"` // Can be null Properties *json.RawMessage `json:"properties" db:"properties" ksql:"properties"` // Can be null // Could also use []byte instead of *json.RawMessage CreatedAt time.Time `json:"created_at" db:"created_at" ksql:"created_at"` }
AccountCompatible is not as nice as AccountIdeal, because it has to use a specialized version of FavNumbers because the helper library can't directly scan a postgres array to a golang []int. This is usually because the helper library is forced to use the stdlib version of pgx.
func (AccountCompatible) String ¶
func (a AccountCompatible) String() string
type AccountIdeal ¶
type AccountIdeal struct { ID uint64 `json:"id" db:"id" ksql:"id"` Name string `json:"name" db:"name" ksql:"name"` Email string `json:"email" db:"email" ksql:"email"` Active bool `json:"active" db:"active" ksql:"active"` FavColor *string `json:"fav_color" db:"fav_color" ksql:"fav_color"` // Can be null // Could also use sql.NullString or Nullable instead of *string FavNumbers []int `json:"fav_numbers" db:"fav_numbers" ksql:"fav_numbers"` // Can be null Properties *json.RawMessage `json:"properties" db:"properties" ksql:"properties"` // Can be null // Could also use []byte instead of *json.RawMessage CreatedAt time.Time `json:"created_at" db:"created_at" ksql:"created_at"` }
AccountIdeal is the ideal model for an "accounts" row we would like to use, with hope that our driver and helper library can directly use this.
func (AccountIdeal) String ¶
func (a AccountIdeal) String() string
type Array ¶
type Array[T any] []T
Array is a wrapper that allows scanning a postgres Array into a golang slice
Click to show internal directories.
Click to hide internal directories.