docs: add package godoc and clarify public API
Prepare the extracted library for external consumption with grouped godoc, extension point docs, and setup requirements. Wire ErrBadCursorString into decode paths and drop redundant Paginate*Conds aliases. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -107,35 +107,11 @@ func BuildQueryCountFn(
|
||||
}
|
||||
|
||||
// PaginateConds returns a mysql.BoolExpression that paginates results using the
|
||||
// provided cursor as a base position.
|
||||
// provided cursor as a base position. Nil or empty cursors match all rows.
|
||||
func PaginateConds[IE mysql.Expression, IC mysql.Column](c *Cursor[IE, IC]) mysql.BoolExpression {
|
||||
return paginateFromGeneric(c)
|
||||
}
|
||||
|
||||
// PaginateIntConds returns a mysql.BoolExpression that paginates results using
|
||||
// the provided integer cursor as a base position.
|
||||
func PaginateIntConds[IE mysql.IntegerExpression, IC mysql.ColumnInteger](c *Cursor[IE, IC]) mysql.BoolExpression {
|
||||
return paginateFromGeneric(c)
|
||||
}
|
||||
|
||||
// PaginateStringConds returns a mysql.BoolExpression that paginates results using
|
||||
// the provided string cursor as a base position.
|
||||
func PaginateStringConds[IE mysql.StringExpression, IC mysql.ColumnString](c *Cursor[IE, IC]) mysql.BoolExpression {
|
||||
return paginateFromGeneric(c)
|
||||
}
|
||||
|
||||
// PaginateUUIDConds returns a mysql.BoolExpression that paginates results using
|
||||
// the provided UUID cursor as a base position.
|
||||
func PaginateUUIDConds[IE mysql.StringExpression, IC mysql.ColumnString](c *Cursor[IE, IC]) mysql.BoolExpression {
|
||||
return paginateFromGeneric(c)
|
||||
}
|
||||
|
||||
// PaginateTimestampConds returns a mysql.BoolExpression that paginates results
|
||||
// using the provided timestamp cursor as a base position.
|
||||
func PaginateTimestampConds[IE mysql.TimestampExpression, IC mysql.ColumnTimestamp](c *Cursor[IE, IC]) mysql.BoolExpression {
|
||||
return paginateFromGeneric(c)
|
||||
}
|
||||
|
||||
func paginateFromGeneric(c GenericCursor) mysql.BoolExpression {
|
||||
if c == nil || c.IsEmpty() {
|
||||
return mysql.Bool(true)
|
||||
@@ -201,7 +177,8 @@ func paginateComposite(c GenericCursor) mysql.BoolExpression {
|
||||
)
|
||||
}
|
||||
|
||||
// OrderByClauses returns ORDER BY clauses matching the cursor pagination semantics.
|
||||
// OrderByClauses returns ORDER BY clauses matching the cursor pagination semantics,
|
||||
// including tuple ordering when [GenericCursor.UsesTupleOrdering] is true.
|
||||
func OrderByClauses(c GenericCursor) []mysql.OrderByClause {
|
||||
if c == nil {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user