mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
* databroker: add support for querying the databroker * remove query method, use getall so encryption works * add test * return early
21 lines
611 B
Go
21 lines
611 B
Go
// Package databroker contains databroker protobuf definitions.
|
|
package databroker
|
|
|
|
// GetUserID gets the databroker user id from a provider user id.
|
|
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)
|
|
}
|