WIP: Migrate from GORM to sqlc - partial migration, build broken
This commit is contained in:
parent
560b40503a
commit
dad96978e0
20 changed files with 1241 additions and 709 deletions
98
backend/internal/db/sqlc/models.go
Normal file
98
backend/internal/db/sqlc/models.go
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type ImcUsersRole string
|
||||
|
||||
const (
|
||||
ImcUsersRoleAdmin ImcUsersRole = "admin"
|
||||
ImcUsersRoleUser ImcUsersRole = "user"
|
||||
)
|
||||
|
||||
func (e *ImcUsersRole) Scan(src interface{}) error {
|
||||
switch s := src.(type) {
|
||||
case []byte:
|
||||
*e = ImcUsersRole(s)
|
||||
case string:
|
||||
*e = ImcUsersRole(s)
|
||||
default:
|
||||
return fmt.Errorf("unsupported scan type for ImcUsersRole: %T", src)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NullImcUsersRole struct {
|
||||
ImcUsersRole ImcUsersRole `json:"imc_users_role"`
|
||||
Valid bool `json:"valid"` // Valid is true if ImcUsersRole is not NULL
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (ns *NullImcUsersRole) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
ns.ImcUsersRole, ns.Valid = "", false
|
||||
return nil
|
||||
}
|
||||
ns.Valid = true
|
||||
return ns.ImcUsersRole.Scan(value)
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (ns NullImcUsersRole) Value() (driver.Value, error) {
|
||||
if !ns.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
return string(ns.ImcUsersRole), nil
|
||||
}
|
||||
|
||||
type ImcLoginAttempt struct {
|
||||
ID uint32 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
IpAddress string `json:"ip_address"`
|
||||
AttemptedAt sql.NullTime `json:"attempted_at"`
|
||||
Successful sql.NullBool `json:"successful"`
|
||||
}
|
||||
|
||||
type ImcUser struct {
|
||||
ID uint32 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
Role NullImcUsersRole `json:"role"`
|
||||
DomainID uint32 `json:"domain_id"`
|
||||
CreatedAt sql.NullTime `json:"created_at"`
|
||||
}
|
||||
|
||||
type ImcUsers2domain struct {
|
||||
ID uint32 `json:"id"`
|
||||
UserID uint32 `json:"user_id"`
|
||||
DomainID uint32 `json:"domain_id"`
|
||||
CreatedAt sql.NullTime `json:"created_at"`
|
||||
}
|
||||
|
||||
type VirtualAlias struct {
|
||||
ID uint32 `json:"id"`
|
||||
DomainID uint32 `json:"domain_id"`
|
||||
Source string `json:"source"`
|
||||
Destination string `json:"destination"`
|
||||
}
|
||||
|
||||
type VirtualDomain struct {
|
||||
ID uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
CreatedAt sql.NullTime `json:"created_at"`
|
||||
}
|
||||
|
||||
type VirtualUser struct {
|
||||
ID uint32 `json:"id"`
|
||||
DomainID uint32 `json:"domain_id"`
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Quota sql.NullInt64 `json:"quota"`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue