Files
quyun-v2/backend/database/models/user_comment_actions.gen.go
2025-12-29 09:30:49 +08:00

60 lines
2.1 KiB
Go

// Code generated by go.ipao.vip/gen. DO NOT EDIT.
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
package models
import (
"context"
"time"
"go.ipao.vip/gen"
)
const TableNameUserCommentAction = "user_comment_actions"
// UserCommentAction mapped from table <user_comment_actions>
type UserCommentAction struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
CommentID int64 `gorm:"column:comment_id;type:bigint;not null" json:"comment_id"`
Type string `gorm:"column:type;type:character varying(32);not null" json:"type"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
}
// Quick operations without importing query package
// Update applies changed fields to the database using the default DB.
func (m *UserCommentAction) Update(ctx context.Context) (gen.ResultInfo, error) {
return Q.UserCommentAction.WithContext(ctx).Updates(m)
}
// Save upserts the model using the default DB.
func (m *UserCommentAction) Save(ctx context.Context) error {
return Q.UserCommentAction.WithContext(ctx).Save(m)
}
// Create inserts the model using the default DB.
func (m *UserCommentAction) Create(ctx context.Context) error {
return Q.UserCommentAction.WithContext(ctx).Create(m)
}
// Delete removes the row represented by the model using the default DB.
func (m *UserCommentAction) Delete(ctx context.Context) (gen.ResultInfo, error) {
return Q.UserCommentAction.WithContext(ctx).Delete(m)
}
// ForceDelete permanently deletes the row (ignores soft delete) using the default DB.
func (m *UserCommentAction) ForceDelete(ctx context.Context) (gen.ResultInfo, error) {
return Q.UserCommentAction.WithContext(ctx).Unscoped().Delete(m)
}
// Reload reloads the model from database by its primary key and overwrites current fields.
func (m *UserCommentAction) Reload(ctx context.Context) error {
fresh, err := Q.UserCommentAction.WithContext(ctx).GetByID(m.ID)
if err != nil {
return err
}
*m = *fresh
return nil
}