mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-10-25 02:44:52 +08:00
Add postgresql support (#792)
* use false for bool type Signed-off-by: ChangFeng <chang_196700@hotmail.com> * use `limit ? offset ?` instead limit ?,? for database compatibility Signed-off-by: ChangFeng <chang_196700@hotmail.com> * add postgresql support Signed-off-by: ChangFeng <chang_196700@hotmail.com> * add postgres options and descriptions Signed-off-by: ChangFeng <chang_196700@hotmail.com> --------- close #791 Signed-off-by: ChangFeng <chang_196700@hotmail.com> Co-authored-by: 玖亖伍 <gsw945@foxmail.com>
This commit is contained in:
@@ -72,7 +72,7 @@ func (m *MemberRelationshipResult) FindForUsersByBookId(lang string, bookId, pag
|
||||
|
||||
var members []*MemberRelationshipResult
|
||||
|
||||
sql1 := "SELECT * FROM md_relationship AS rel LEFT JOIN md_members as mdmb ON rel.member_id = mdmb.member_id WHERE rel.book_id = ? ORDER BY rel.relationship_id DESC LIMIT ?,?"
|
||||
sql1 := "SELECT * FROM md_relationship AS rel LEFT JOIN md_members as mdmb ON rel.member_id = mdmb.member_id WHERE rel.book_id = ? ORDER BY rel.relationship_id DESC limit ? offset ?"
|
||||
|
||||
sql2 := "SELECT count(*) AS total_count FROM md_relationship AS rel LEFT JOIN md_members as mdmb ON rel.member_id = mdmb.member_id WHERE rel.book_id = ?"
|
||||
|
||||
@@ -86,7 +86,7 @@ func (m *MemberRelationshipResult) FindForUsersByBookId(lang string, bookId, pag
|
||||
|
||||
offset := (pageIndex - 1) * pageSize
|
||||
|
||||
_, err = o.Raw(sql1, bookId, offset, pageSize).QueryRows(&members)
|
||||
_, err = o.Raw(sql1, bookId, pageSize, offset).QueryRows(&members)
|
||||
|
||||
if err != nil {
|
||||
return members, 0, err
|
||||
|
||||
Reference in New Issue
Block a user