Documentation
¶
Index ¶
- Constants
- Variables
- func Delete(q *bun.SelectQuery, opts *commonv3.QueryOptions) (*bun.UpdateQuery, error)
- func FilterLabels(q *bun.SelectQuery, opts *commonv3.QueryOptions) (*bun.SelectQuery, error)
- func Get(q *bun.SelectQuery, opts *commonv3.QueryOptions) (*bun.SelectQuery, error)
- func GetAccountID(opts *commonv3.QueryOptions) (string, error)
- func GetClusterID(opts *commonv3.QueryOptions) (string, error)
- func GetOrganizationID(opts *commonv3.QueryOptions) (string, error)
- func Paginate(q *bun.SelectQuery, opts *commonv3.QueryOptions) *bun.SelectQuery
- func Select(q *bun.SelectQuery, opts *commonv3.QueryOptions) (*bun.SelectQuery, error)
- func Update(uq *bun.UpdateQuery, opts *commonv3.QueryOptions) (*bun.UpdateQuery, error)
- type Option
- func WithDeleted() Option
- func WithExtended() Option
- func WithGlobalScope() Option
- func WithIgnoreScopeDefault() Option
- func WithMeta(o *commonv3.Metadata) Option
- func WithName(name string) Option
- func WithOptions(in *commonv3.QueryOptions) Option
- func WithOrganizationID(organizationID string) Option
- func WithPartnerID(partnerID string) Option
- func WithProjectID(projectID string) Option
- func WithSelector(selector string) Option
Constants ¶
const ( // DefaultLimit is the default limit if no limit is set in query options DefaultLimit = 10 // MaxLimit is the max limit for page size MaxLimit = 50 // MaxOffset is the max offset MaxOffset = 100000 // DefaultOrderBy is the default column used to order results DefaultOrderBy = "created_at" // DefaultOrder is the order of the results DefaultOrder = orderASC )
Variables ¶
var ( // ErrNoName is returned when name is not set in query option // trying to build query for get/update/delete ErrNoName = errors.New("name not set in options") ErrNoNameOrID = errors.New("neither name nor id is set in options") )
Functions ¶
func Delete ¶
func Delete(q *bun.SelectQuery, opts *commonv3.QueryOptions) (*bun.UpdateQuery, error)
Delete builds query for deleting resource
func FilterLabels ¶
func FilterLabels(q *bun.SelectQuery, opts *commonv3.QueryOptions) (*bun.SelectQuery, error)
FilterLabels adds query filter for labels based on the selector
func Get ¶
func Get(q *bun.SelectQuery, opts *commonv3.QueryOptions) (*bun.SelectQuery, error)
Get builds query for getting resource
func GetAccountID ¶
func GetAccountID(opts *commonv3.QueryOptions) (string, error)
GetAccountID returns account ID from QueryOptions
func GetClusterID ¶
func GetClusterID(opts *commonv3.QueryOptions) (string, error)
GetClusterID returns cluster ID from QueryOptions
func GetOrganizationID ¶
func GetOrganizationID(opts *commonv3.QueryOptions) (string, error)
GetOrganizationID returns organization id from QueryOptions
func Paginate ¶
func Paginate(q *bun.SelectQuery, opts *commonv3.QueryOptions) *bun.SelectQuery
func Select ¶
func Select(q *bun.SelectQuery, opts *commonv3.QueryOptions) (*bun.SelectQuery, error)
Select builds query for selecting resources
func Update ¶
func Update(uq *bun.UpdateQuery, opts *commonv3.QueryOptions) (*bun.UpdateQuery, error)
Update builds query for updating resource
Types ¶
type Option ¶
type Option func(*commonv3.QueryOptions)
Option is the functional query option signature
func WithGlobalScope ¶
func WithGlobalScope() Option
WithGlobalScope should be used to query resources in global scope partnerID, orgID, projectID = 0, 0, 0
func WithIgnoreScopeDefault ¶
func WithIgnoreScopeDefault() Option
WithIgnoreScopeDefault ignores default values for scope when building queries
func WithOptions ¶
func WithOptions(in *commonv3.QueryOptions) Option
WithOptions copies options to query options
func WithOrganizationID ¶
WithOrganizationID sets organization id in query options
func WithPartnerID ¶
WithPartnerID sets partner id in query options
func WithProjectID ¶
WithProjectID sets project id in query options
func WithSelector ¶
WithSelector sets selector in query options