优化表结构,重构模型,重新实现基于白银网关的提取节点流程
This commit is contained in:
29
web/core/model.go
Normal file
29
web/core/model.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"platform/pkg/u"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type IModel interface {
|
||||
GetID() int32
|
||||
}
|
||||
|
||||
type Model struct {
|
||||
ID int32 `json:"id" gorm:"column:id;primaryKey"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"column:created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"column:deleted_at"`
|
||||
}
|
||||
|
||||
func (m *Model) GetID() int32 {
|
||||
return m.ID
|
||||
}
|
||||
|
||||
func GetIDs[T IModel](models []T) []int32 {
|
||||
return u.Map(models, func(m T) int32 {
|
||||
return m.GetID()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user