kubbot & kubecub 74de8825f6 fix bug
Signed-off-by: kubbot & kubecub <3293172751ysy@gmail.com>
2023-06-30 22:32:30 +08:00

24 lines
309 B
Go

package relation
import (
"context"
"gorm.io/gorm"
)
type MetaDB struct {
DB *gorm.DB
table any
}
func NewMetaDB(db *gorm.DB, table any) *MetaDB {
return &MetaDB{
DB: db,
table: table,
}
}
func (g *MetaDB) db(ctx context.Context) *gorm.DB {
return g.DB.WithContext(ctx).Model(g.table)
}