feat(sqltypes): add nullable SQL types with automatic casting
* Introduced SqlNull type for nullable values with auto-casting. * Implemented JSON, YAML, and XML marshaling/unmarshaling. * Added specific types for common SQL types (e.g., SqlInt64, SqlString). * Included utility functions for creating nullable types. * Added SqlTimeStamp, SqlDate, and SqlTime types with custom formatting.
This commit is contained in:
@@ -3,17 +3,17 @@ package generatedmodels
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
||||
sql_types "git.warky.dev/wdevs/relspecgo/pkg/sqltypes"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type ModelPublicOauthClients struct {
|
||||
bun.BaseModel `bun:"table:public.oauth_clients,alias:oauth_clients"`
|
||||
ID resolvespec_common.SqlInt64 `bun:"id,type:bigserial,pk,autoincrement," json:"id"`
|
||||
ClientID resolvespec_common.SqlString `bun:"client_id,type:text,notnull," json:"client_id"`
|
||||
ClientName resolvespec_common.SqlString `bun:"client_name,type:text,default:'',notnull," json:"client_name"`
|
||||
CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"`
|
||||
RedirectUris resolvespec_common.SqlStringArray `bun:"redirect_uris,type:text[],default:'{}',notnull," json:"redirect_uris"`
|
||||
ID sql_types.SqlInt64 `bun:"id,type:bigserial,pk,autoincrement," json:"id"`
|
||||
ClientID sql_types.SqlString `bun:"client_id,type:text,notnull," json:"client_id"`
|
||||
ClientName sql_types.SqlString `bun:"client_name,type:text,default:'',notnull," json:"client_name"`
|
||||
CreatedAt sql_types.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"`
|
||||
RedirectUris sql_types.SqlStringArray `bun:"redirect_uris,type:text[],default:'{}',notnull," json:"redirect_uris"`
|
||||
}
|
||||
|
||||
// TableName returns the table name for ModelPublicOauthClients
|
||||
|
||||
Reference in New Issue
Block a user