feat: migrate serevices
Some checks failed
build quyun / Build (push) Failing after 2m50s

This commit is contained in:
2025-12-19 19:05:12 +08:00
parent 005585c53b
commit 557a641f41
71 changed files with 5626 additions and 280 deletions

View File

@@ -8,6 +8,8 @@ import (
"context"
"time"
"quyun/v2/pkg/fields"
"go.ipao.vip/gen"
"go.ipao.vip/gen/types"
"gorm.io/gorm"
@@ -17,21 +19,21 @@ const TableNamePost = "posts"
// Post mapped from table <posts>
type Post struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp without time zone;not null;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp without time zone;not null;default:now()" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp without time zone" json:"deleted_at"`
Status int16 `gorm:"column:status;type:smallint;not null" json:"status"`
Title string `gorm:"column:title;type:character varying(128);not null" json:"title"`
HeadImages types.JSON `gorm:"column:head_images;type:jsonb;not null;default:[]" json:"head_images"`
Description string `gorm:"column:description;type:character varying(256);not null" json:"description"`
Content string `gorm:"column:content;type:text;not null" json:"content"`
Price int64 `gorm:"column:price;type:bigint;not null" json:"price"`
Discount int16 `gorm:"column:discount;type:smallint;not null;default:100" json:"discount"`
Views int64 `gorm:"column:views;type:bigint;not null" json:"views"`
Likes int64 `gorm:"column:likes;type:bigint;not null" json:"likes"`
Tags types.JSON `gorm:"column:tags;type:jsonb;default:{}" json:"tags"`
Assets types.JSON `gorm:"column:assets;type:jsonb;default:{}" json:"assets"`
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp without time zone;not null;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp without time zone;not null;default:now()" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp without time zone" json:"deleted_at"`
Status fields.PostStatus `gorm:"column:status;type:smallint;not null" json:"status"`
Title string `gorm:"column:title;type:character varying(128);not null" json:"title"`
HeadImages types.JSONType[[]int64] `gorm:"column:head_images;type:jsonb;not null;default:[]" json:"head_images"`
Description string `gorm:"column:description;type:character varying(256);not null" json:"description"`
Content string `gorm:"column:content;type:text;not null" json:"content"`
Price int64 `gorm:"column:price;type:bigint;not null" json:"price"`
Discount int16 `gorm:"column:discount;type:smallint;not null;default:100" json:"discount"`
Views int64 `gorm:"column:views;type:bigint;not null" json:"views"`
Likes int64 `gorm:"column:likes;type:bigint;not null" json:"likes"`
Tags types.JSONType[[]string] `gorm:"column:tags;type:jsonb;default:{}" json:"tags"`
Assets types.JSONType[[]fields.MediaAsset] `gorm:"column:assets;type:jsonb;default:{}" json:"assets"`
}
// Quick operations without importing query package