33 lines
759 B
Smarty
33 lines
759 B
Smarty
// 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
|
|
{{- range . }}
|
|
func {{.PascalTable}}Model() *{{.PascalTable}} { return &{{.PascalTable}}{} }
|
|
{{- end }}
|
|
|
|
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
|
|
}
|