This commit is contained in:
xing 2022-08-28 22:03:52 +08:00
parent ff8ef956ef
commit a2c593885a
2 changed files with 10 additions and 2 deletions

View File

@ -19,9 +19,9 @@ func init() {
}
func main() {
T, total, err := models.WpPostsM.SimplePagination(nil, "*", 1, 10, models.SqlBuilder{{"ID", "desc"}})
T, err := models.WpPostsM.FindOneById(1)
if err != nil {
return
}
fmt.Println(T, total)
fmt.Println(T)
}

View File

@ -15,6 +15,14 @@ type mod interface {
type model[T mod] struct {
}
func (m model[T]) PrimaryKey() string {
return "id"
}
func (m model[T]) Table() string {
return ""
}
type SqlBuilder [][]string
func (w SqlBuilder) parseWhere() (string, []interface{}) {