Loading...
Loading...
Generate Go GORM models following Pingo modular architecture conventions. Use when creating or updating persistence models in internal/modules/<module>/model/, including table mapping, nullable SQL types, timestamps, and relation fields for identity and monitor modules.
npx skill4agent add cristiano-pacheco/ai-tools go-gorm-modelinternal/modules/<module>/model/internal/modules/<module>/model/<entity>_model.gomodel<Entity>Modelfunc (*<Entity>Model) TableName() string { return "<table_name>" }package modeltimedatabase/sqlTableName()package model
import (
"database/sql"
"time"
)
type EntityModel struct {
ID uint64 `gorm:"primarykey"`
Name string `gorm:"column:name"`
Meta sql.NullString `gorm:"column:meta"`
CreatedAt time.Time `gorm:"column:created_at"`
UpdatedAt time.Time `gorm:"column:updated_at"`
}
func (*EntityModel) TableName() string {
return "entities"
}gorm:"column:..."uint64ID uint64 `gorm:"primarykey"` time.TimeCreatedAt time.TimeUpdatedAt time.Timedatabase/sqlsql.NullStringsql.NullInt32sql.NullBoolsql.NullTimeNonce sql.NullStringStatusCode sql.NullInt32ResponseTimeMs sql.NullInt32Field string `gorm:"column:field_name"` TableName()authorization_codesexternal_accountshttp_monitor_checkscontactsinternal/modules/<module>/model/<entity>_model.gogormprimarykeycolumn:...TableName()make testmake lintBIGINT/UNSIGNED BIGINTuint64VARCHAR/TEXTstringBOOLEANboolTIMESTAMP/DATETIMEtime.Timesql.NullStringsql.NullInt32sql.NullTime[]bytetype AuthorizationCodeModel struct {
ID uint64 `gorm:"primarykey"`
CodeHash []byte `gorm:"column:code_hash"`
UserID uint64 `gorm:"column:user_id"`
ClientID string `gorm:"column:client_id"`
RedirectURI string `gorm:"column:redirect_uri"`
Scope string `gorm:"column:scope"`
CodeChallenge string `gorm:"column:code_challenge"`
CodeChallengeMethod string `gorm:"column:code_challenge_method;default:S256"`
Nonce sql.NullString `gorm:"column:nonce"`
ExpiresAt time.Time `gorm:"column:expires_at"`
CreatedAt time.Time `gorm:"column:created_at"`
}type HTTPMonitorCheckModel struct {
ID uint64 `gorm:"primarykey"`
HTTPMonitorID uint64 `gorm:"column:http_monitor_id"`
CheckedAt time.Time `gorm:"column:checked_at"`
ResponseTimeMs sql.NullInt32 `gorm:"column:response_time_ms"`
StatusCode sql.NullInt32 `gorm:"column:status_code"`
Success bool `gorm:"column:success"`
ErrorMessage sql.NullString `gorm:"column:error_message"`
}internal/modules/<module>/modeljsoninternal/modules/<module>/model/<Entity>ModelID uint64gorm:"primarykey"database/sqlTableName()make testmake lint