mirror of
https://github.com/samuelncui/yatm.git
synced 2026-01-08 14:21:19 +00:00
22 lines
276 B
Go
22 lines
276 B
Go
package library
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
const (
|
|
batchSize = 100
|
|
)
|
|
|
|
type Library struct {
|
|
db *gorm.DB
|
|
}
|
|
|
|
func New(db *gorm.DB) *Library {
|
|
return &Library{db: db}
|
|
}
|
|
|
|
func (l *Library) AutoMigrate() error {
|
|
return l.db.AutoMigrate(ModelFile, ModelPosition, ModelTape)
|
|
}
|