diff --git a/main.go b/main.go index 3b1b32e..7ba3804 100644 --- a/main.go +++ b/main.go @@ -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) } diff --git a/models/model.go b/models/model.go index 137714e..d5a4916 100644 --- a/models/model.go +++ b/models/model.go @@ -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{}) {