Documentation
¶
Index ¶
- func NewGormDBFromPool(ctx context.Context, pool *pgxpool.Pool) (*gorm.DB, error)
- func QualifiedTable(schemaName, tableName string) (string, error)
- func QuoteIdentifier(identifier string) (string, error)
- func TenantTable(db *gorm.DB, schemaName, tableName string) (*gorm.DB, error)
- func ValidateIdentifier(identifier string) error
- type Decimal
- func (Decimal) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (Decimal) GormDataType() string
- func (d Decimal) MarshalJSON() ([]byte, error)
- func (d *Decimal) Scan(value interface{}) error
- func (d *Decimal) UnmarshalJSON(data []byte) error
- func (d Decimal) Value() (driver.Value, error)
- type GormDB
- type JSONB
- type JSONBRaw
- func (JSONBRaw) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (JSONBRaw) GormDataType() string
- func (j JSONBRaw) MarshalJSON() ([]byte, error)
- func (j *JSONBRaw) Scan(value interface{}) error
- func (j *JSONBRaw) UnmarshalJSON(data []byte) error
- func (j JSONBRaw) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGormDBFromPool ¶
NewGormDBFromPool creates a GORM handle from the existing pgx pool configuration.
func QualifiedTable ¶
QualifiedTable returns a schema-qualified table reference safe for interpolation.
func QuoteIdentifier ¶
QuoteIdentifier safely quotes a validated SQL identifier.
func TenantTable ¶
TenantTable returns a GORM handle bound to an explicit schema-qualified table.
func ValidateIdentifier ¶
ValidateIdentifier ensures a schema/table identifier is safe to interpolate.
Types ¶
type Decimal ¶
Decimal wraps shopspring/decimal for GORM compatibility It implements the necessary interfaces for database scanning and value conversion
func NewDecimal ¶
NewDecimal creates a new Decimal from a shopspring decimal
func NewDecimalFromFloat ¶
NewDecimalFromFloat creates a new Decimal from a float64
func NewDecimalFromString ¶
NewDecimalFromString creates a new Decimal from a string
func (Decimal) GormDBDataType ¶
GormDBDataType returns the database data type based on dialect
func (Decimal) GormDataType ¶
GormDataType returns the GORM data type for this field
func (Decimal) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Decimal) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type GormDB ¶
GormDB wraps gorm.DB and provides multi-tenant support
func (*GormDB) Transaction ¶
Transaction executes a function within a database transaction
type JSONB ¶
type JSONB map[string]interface{}
JSONB represents a PostgreSQL JSONB column
func (JSONB) GormDBDataType ¶
GormDBDataType returns the database data type based on dialect
func (JSONB) GormDataType ¶
GormDataType returns the GORM data type for this field
type JSONBRaw ¶
type JSONBRaw json.RawMessage
JSONBRaw represents a raw JSONB column that preserves the original JSON
func (JSONBRaw) GormDBDataType ¶
GormDBDataType returns the database data type based on dialect
func (JSONBRaw) GormDataType ¶
GormDataType returns the GORM data type for this field
func (JSONBRaw) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*JSONBRaw) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler