mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-16 18:47:10 +02:00
databroker: add support for querying the databroker (#1443)
* databroker: add support for querying the databroker * remove query method, use getall so encryption works * add test * return early
This commit is contained in:
parent
fdec45fe04
commit
2364da14c8
8 changed files with 534 additions and 118 deletions
|
@ -5,3 +5,17 @@ package databroker
|
|||
func GetUserID(provider, providerUserID string) string {
|
||||
return provider + "/" + providerUserID
|
||||
}
|
||||
|
||||
// ApplyOffsetAndLimit applies the offset and limit to the list of records.
|
||||
func ApplyOffsetAndLimit(all []*Record, offset, limit int) (records []*Record, totalCount int) {
|
||||
records = all
|
||||
if offset < len(records) {
|
||||
records = records[offset:]
|
||||
} else {
|
||||
records = nil
|
||||
}
|
||||
if limit <= len(records) {
|
||||
records = records[:limit]
|
||||
}
|
||||
return records, len(all)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue