Files
whatshooked/pkg/models/sql_public_message_cache.go
Hein 524bc4179b
Some checks failed
CI / Test (1.22) (push) Failing after -23m2s
CI / Test (1.23) (push) Failing after -22m58s
CI / Lint (push) Has been cancelled
CI / Build (push) Has been cancelled
fix(models): update models to use public schema and correct types
* Rename models to plural form for consistency
* Change table names to include 'public' schema
* Update timestamp types to SqlTimeStamp for consistency
* Adjust relationships to use pluralized user models
2026-02-20 16:11:23 +02:00

67 lines
2.4 KiB
Go

// Code generated by relspecgo. DO NOT EDIT.
package models
import (
"fmt"
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
"github.com/uptrace/bun"
)
type ModelPublicMessageCache struct {
bun.BaseModel `bun:"table:public.message_cache,alias:message_cache"`
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
AccountID resolvespec_common.SqlString `bun:"account_id,type:varchar(36),notnull," json:"account_id"`
ChatID resolvespec_common.SqlString `bun:"chat_id,type:varchar(255),notnull," json:"chat_id"`
Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` // JSON encoded message content
CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamp,default:now(),notnull," json:"created_at"`
FromMe bool `bun:"from_me,type:boolean,notnull," json:"from_me"`
MessageID resolvespec_common.SqlString `bun:"message_id,type:varchar(255),notnull," json:"message_id"`
MessageType resolvespec_common.SqlString `bun:"message_type,type:varchar(50),notnull," json:"message_type"` // text
Timestamp resolvespec_common.SqlTimeStamp `bun:"timestamp,type:timestamp,notnull," json:"timestamp"`
}
// TableName returns the table name for ModelPublicMessageCache
func (m ModelPublicMessageCache) TableName() string {
return "public.message_cache"
}
// TableNameOnly returns the table name without schema for ModelPublicMessageCache
func (m ModelPublicMessageCache) TableNameOnly() string {
return "message_cache"
}
// SchemaName returns the schema name for ModelPublicMessageCache
func (m ModelPublicMessageCache) SchemaName() string {
return "public"
}
// GetID returns the primary key value
func (m ModelPublicMessageCache) GetID() int64 {
return m.ID.Int64()
}
// GetIDStr returns the primary key as a string
func (m ModelPublicMessageCache) GetIDStr() string {
return fmt.Sprintf("%d", m.ID)
}
// SetID sets the primary key value
func (m ModelPublicMessageCache) SetID(newid int64) {
m.UpdateID(newid)
}
// UpdateID updates the primary key value
func (m *ModelPublicMessageCache) UpdateID(newid int64) {
m.ID.FromString(fmt.Sprintf("%d", newid))
}
// GetIDName returns the name of the primary key column
func (m ModelPublicMessageCache) GetIDName() string {
return "id"
}
// GetPrefix returns the table prefix
func (m ModelPublicMessageCache) GetPrefix() string {
return "MCE"
}