pending
This commit is contained in:
65
backend/database/models/content_assets.gen.go
Normal file
65
backend/database/models/content_assets.gen.go
Normal file
@@ -0,0 +1,65 @@
|
||||
// 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"
|
||||
|
||||
"quyun/v2/pkg/consts"
|
||||
|
||||
"go.ipao.vip/gen"
|
||||
)
|
||||
|
||||
const TableNameContentAsset = "content_assets"
|
||||
|
||||
// ContentAsset mapped from table <content_assets>
|
||||
type ContentAsset struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
|
||||
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
|
||||
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
|
||||
ContentID int64 `gorm:"column:content_id;type:bigint;not null" json:"content_id"`
|
||||
AssetID int64 `gorm:"column:asset_id;type:bigint;not null" json:"asset_id"`
|
||||
Role consts.ContentAssetRole `gorm:"column:role;type:character varying(32);not null;default:main" json:"role"`
|
||||
Sort int32 `gorm:"column:sort;type:integer;not null" json:"sort"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;not null;default:now()" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;not null;default:now()" json:"updated_at"`
|
||||
}
|
||||
|
||||
// Quick operations without importing query package
|
||||
// Update applies changed fields to the database using the default DB.
|
||||
func (m *ContentAsset) Update(ctx context.Context) (gen.ResultInfo, error) {
|
||||
return Q.ContentAsset.WithContext(ctx).Updates(m)
|
||||
}
|
||||
|
||||
// Save upserts the model using the default DB.
|
||||
func (m *ContentAsset) Save(ctx context.Context) error {
|
||||
return Q.ContentAsset.WithContext(ctx).Save(m)
|
||||
}
|
||||
|
||||
// Create inserts the model using the default DB.
|
||||
func (m *ContentAsset) Create(ctx context.Context) error {
|
||||
return Q.ContentAsset.WithContext(ctx).Create(m)
|
||||
}
|
||||
|
||||
// Delete removes the row represented by the model using the default DB.
|
||||
func (m *ContentAsset) Delete(ctx context.Context) (gen.ResultInfo, error) {
|
||||
return Q.ContentAsset.WithContext(ctx).Delete(m)
|
||||
}
|
||||
|
||||
// ForceDelete permanently deletes the row (ignores soft delete) using the default DB.
|
||||
func (m *ContentAsset) ForceDelete(ctx context.Context) (gen.ResultInfo, error) {
|
||||
return Q.ContentAsset.WithContext(ctx).Unscoped().Delete(m)
|
||||
}
|
||||
|
||||
// Reload reloads the model from database by its primary key and overwrites current fields.
|
||||
func (m *ContentAsset) Reload(ctx context.Context) error {
|
||||
fresh, err := Q.ContentAsset.WithContext(ctx).GetByID(m.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*m = *fresh
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user