3d4e6d0939
* 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.
66 lines
2.5 KiB
Go
66 lines
2.5 KiB
Go
// Code generated by relspecgo. DO NOT EDIT.
|
|
package generatedmodels
|
|
|
|
import (
|
|
"fmt"
|
|
sql_types "git.warky.dev/wdevs/relspecgo/pkg/sqltypes"
|
|
"github.com/uptrace/bun"
|
|
)
|
|
|
|
type ModelPublicCharacterArcs struct {
|
|
bun.BaseModel `bun:"table:public.character_arcs,alias:character_arcs"`
|
|
ID sql_types.SqlInt64 `bun:"id,type:bigserial,pk,autoincrement," json:"id"`
|
|
CreatedAt sql_types.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"`
|
|
Description sql_types.SqlString `bun:"description,type:text,default:'',notnull," json:"description"`
|
|
Name sql_types.SqlString `bun:"name,type:text,notnull," json:"name"`
|
|
Summary sql_types.SqlString `bun:"summary,type:text,default:'',notnull," json:"summary"`
|
|
UpdatedAt sql_types.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"`
|
|
RelArcIDPublicArcStages []*ModelPublicArcStages `bun:"rel:has-many,join:id=arc_id" json:"relarcidpublicarcstages,omitempty"` // Has many ModelPublicArcStages
|
|
RelArcIDPublicPersonaArcs []*ModelPublicPersonaArc `bun:"rel:has-many,join:id=arc_id" json:"relarcidpublicpersonaarcs,omitempty"` // Has many ModelPublicPersonaArc
|
|
}
|
|
|
|
// TableName returns the table name for ModelPublicCharacterArcs
|
|
func (m ModelPublicCharacterArcs) TableName() string {
|
|
return "public.character_arcs"
|
|
}
|
|
|
|
// TableNameOnly returns the table name without schema for ModelPublicCharacterArcs
|
|
func (m ModelPublicCharacterArcs) TableNameOnly() string {
|
|
return "character_arcs"
|
|
}
|
|
|
|
// SchemaName returns the schema name for ModelPublicCharacterArcs
|
|
func (m ModelPublicCharacterArcs) SchemaName() string {
|
|
return "public"
|
|
}
|
|
|
|
// GetID returns the primary key value
|
|
func (m ModelPublicCharacterArcs) GetID() int64 {
|
|
return m.ID.Int64()
|
|
}
|
|
|
|
// GetIDStr returns the primary key as a string
|
|
func (m ModelPublicCharacterArcs) GetIDStr() string {
|
|
return m.ID.String()
|
|
}
|
|
|
|
// SetID sets the primary key value
|
|
func (m ModelPublicCharacterArcs) SetID(newid int64) {
|
|
m.UpdateID(newid)
|
|
}
|
|
|
|
// UpdateID updates the primary key value
|
|
func (m *ModelPublicCharacterArcs) UpdateID(newid int64) {
|
|
m.ID.FromString(fmt.Sprintf("%d", newid))
|
|
}
|
|
|
|
// GetIDName returns the name of the primary key column
|
|
func (m ModelPublicCharacterArcs) GetIDName() string {
|
|
return "id"
|
|
}
|
|
|
|
// GetPrefix returns the table prefix
|
|
func (m ModelPublicCharacterArcs) GetPrefix() string {
|
|
return "CAH"
|
|
}
|