struct QueryPattern

Overview

This checks if any field in a collection of fields matches a pattern. It is used in query loaders and response filters to match request parameters with a pattern to determine which items should appear in API responses.

A pattern is always two parts; a resource and an attribute separated by a dot (.). Eg: user.name, bearer_login.name, login.*.

IDs and foreign keys are always skipped because they are always already included in responses. Patterns that end with ".*" are wildcards.

Defined in:

utilities/query_pattern.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(pattern : String) #

[View source]

Class Method Detail

def self.match?(pattern, fields) #

[View source]

Instance Method Detail

def match?(fields : Indexable(String) | Nil) : Bool | Nil #

[View source]
def match?(*fields : String) #

[View source]