36 lines
844 B
Go
36 lines
844 B
Go
// Code generated by the atomctl ; DO NOT EDIT.
|
|
// Code generated by the atomctl ; DO NOT EDIT.
|
|
// Code generated by the atomctl ; DO NOT EDIT.
|
|
package model
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
|
|
"go.ipao.vip/atom"
|
|
"go.ipao.vip/atom/container"
|
|
"go.ipao.vip/atom/contracts"
|
|
"go.ipao.vip/atom/opt"
|
|
)
|
|
|
|
var db *sql.DB
|
|
|
|
func MediasModel() *Medias { return &Medias{} }
|
|
func OrdersModel() *Orders { return &Orders{} }
|
|
func PostsModel() *Posts { return &Posts{} }
|
|
func UsersModel() *Users { return &Users{} }
|
|
|
|
func Transaction(ctx context.Context) (*sql.Tx, error) { return db.Begin() }
|
|
|
|
func DB() *sql.DB { return db }
|
|
|
|
func Provide(opts ...opt.Option) error {
|
|
if err := container.Container.Provide(func(_db *sql.DB) (contracts.Initial, error) {
|
|
db = _db
|
|
return nil, nil
|
|
}, atom.GroupInitial); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|