You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
496 B
26 lines
496 B
5 years ago
|
package dao
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"{{.ModPrefix}}{{.Name}}/internal/model"
|
||
|
"github.com/bilibili/kratos/pkg/conf/paladin"
|
||
|
"github.com/bilibili/kratos/pkg/database/sql"
|
||
|
)
|
||
|
|
||
|
func NewDB() (db *sql.DB, err error) {
|
||
|
var cfg struct {
|
||
|
Client *sql.Config
|
||
|
}
|
||
|
if err = paladin.Get("db.toml").UnmarshalTOML(&cfg); err != nil {
|
||
|
return
|
||
|
}
|
||
|
db = sql.NewMySQL(cfg.Client)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (d *dao) RawArticle(ctx context.Context, id int64) (art *model.Article, err error) {
|
||
|
// get data from db
|
||
|
return
|
||
|
}
|