// Code generated by gowebx, DO AVOID EDIT.
package audioencodedb

import (
	"easyaudioencode/internal/core/audioencode"
	"gorm.io/gorm"
)

var _ audioencode.Storer = DB{}

// DB Related business namespaces
type DB struct {
	db *gorm.DB
}

// NewDB instance object
func NewDB(db *gorm.DB) DB {
	return DB{db: db}
}

// AudioEncode Get business instance
func (d DB) AudioEncode() audioencode.AudioEncodeStorer {
	return AudioEncode(d)
}
func (d DB) AudioTask() audioencode.AudioTaskStorer {
	return AudioTask(d)
}

// AutoMigrate sync database
func (d DB) AutoMigrate(ok bool) DB {
	if !ok {
		return d
	}
	if err := d.db.AutoMigrate(
		new(audioencode.AudioEncode),
		new(audioencode.AudioTask),
	); err != nil {
		panic(err)
	}
	return d
}
