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.
65 lines
2.3 KiB
Go
65 lines
2.3 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 ModelPublicProjectPersonas struct {
|
|
bun.BaseModel `bun:"table:public.project_personas,alias:project_personas"`
|
|
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"`
|
|
IsDefault bool `bun:"is_default,type:boolean,default:false,notnull," json:"is_default"`
|
|
PersonaID int64 `bun:"persona_id,type:bigint,notnull," json:"persona_id"`
|
|
ProjectID int64 `bun:"project_id,type:bigint,notnull," json:"project_id"`
|
|
RelPersonaID *ModelPublicAgentPersonas `bun:"rel:has-one,join:persona_id=id" json:"relpersonaid,omitempty"` // Has one ModelPublicAgentPersonas
|
|
RelProjectID *ModelPublicProjects `bun:"rel:has-one,join:project_id=id" json:"relprojectid,omitempty"` // Has one ModelPublicProjects
|
|
}
|
|
|
|
// TableName returns the table name for ModelPublicProjectPersonas
|
|
func (m ModelPublicProjectPersonas) TableName() string {
|
|
return "public.project_personas"
|
|
}
|
|
|
|
// TableNameOnly returns the table name without schema for ModelPublicProjectPersonas
|
|
func (m ModelPublicProjectPersonas) TableNameOnly() string {
|
|
return "project_personas"
|
|
}
|
|
|
|
// SchemaName returns the schema name for ModelPublicProjectPersonas
|
|
func (m ModelPublicProjectPersonas) SchemaName() string {
|
|
return "public"
|
|
}
|
|
|
|
// GetID returns the primary key value
|
|
func (m ModelPublicProjectPersonas) GetID() int64 {
|
|
return m.ID.Int64()
|
|
}
|
|
|
|
// GetIDStr returns the primary key as a string
|
|
func (m ModelPublicProjectPersonas) GetIDStr() string {
|
|
return m.ID.String()
|
|
}
|
|
|
|
// SetID sets the primary key value
|
|
func (m ModelPublicProjectPersonas) SetID(newid int64) {
|
|
m.UpdateID(newid)
|
|
}
|
|
|
|
// UpdateID updates the primary key value
|
|
func (m *ModelPublicProjectPersonas) UpdateID(newid int64) {
|
|
m.ID.FromString(fmt.Sprintf("%d", newid))
|
|
}
|
|
|
|
// GetIDName returns the name of the primary key column
|
|
func (m ModelPublicProjectPersonas) GetIDName() string {
|
|
return "id"
|
|
}
|
|
|
|
// GetPrefix returns the table prefix
|
|
func (m ModelPublicProjectPersonas) GetPrefix() string {
|
|
return "PPR"
|
|
}
|