Skip to content

Latest commit

 

History

History
806 lines (411 loc) · 23.2 KB

index.md

File metadata and controls

806 lines (411 loc) · 23.2 KB

Reference Guide

Date Functions

Function to calculate the calendar month of a date or datetime value

Function to calculate the calendar quarter of a date or datetime value

Function to calculate the calendar year of a date or datetime value

Factory class to create date functions by name

Repository of aggregate date functions

Interface for date functions

Exceptions

Generic exception for when something is not found

Custom exception for parsing errors

This class is responsible for handling validation exceptions

fflib

Generates fake Salesforce Ids for testing purposes

Interfaces

Interface for a builder class

Mock Database

The MockDatabase class is used to simulate the Salesforce database in Apex unit tests

Types defined for this package

Moxygen

DML class to handle DML operations, wrapper around Database methods to allow for mocking and stubbing in unit tests.

ORM class is the state manager for the Moxygen library. It is responsble for managing the state of the library's settings and context. It's named ORM because Salesforce is an ORM, and unfortunately, the Database namespace is already taken.

Wrapper class for Database class's query methods. This class is used to allow for mocking of the Database class in unit tests.

Uncategorized

Represents and AST as stored in the parser static resources

Aggregate class to represent the result of an aggregate query

Creates Aggregate objects from ProtoAggregates

Generates an instance of an aggregate calculator based on the type provided

Options for the AggregateCalculator class

A class to compare two pre-Aggregate based on a set of fields (a pre-Aggregate is a ProtoAggregate where the keys are the field names and the values are the field values)

This class is responsible for parsing aggregate functions

Handles the limit for the aggregate query

Handler for offsetting aggregate results

Handles the ORDER BY clause for aggregate queries

Processor for aggregate functions

This class is responsible for handling the aggregate queries

Contains static methods for working with aggregates and proto-aggregates

Standard processor for aggregate queries

This class is responsible for parsing aliases in the query

Tool for finding the aliases on nodes

A class that contains the names of the Apex types.

Attributes for SObject

Calculates the average of a set of values.

A class to parse a bind variable

A class to handle boolean logic, when it comes to HAVING and WHERE clauses, it's all the same except for the comparison

This class is used to store the options for the BooleanLogic class

A parser for boolean values

Calculates the calendar month from a date value

Calculates the calendar month from a date value

Calculates the calendar month from a date value

Child subquery select handler

Common utility class for basic operations, should not contain complex code

Encapsulates the data needed to compare records

This class provides the ability to compare fields on SObjects with the mock database

CountCalculator is a concrete implementation of IAggregateCalculator that calculates the count of records.

CountDistinctCalculator is a class that implements the IAggregateCalculator interface. It calculates the distinct count of a field.

Handles the limit for the count of records

OffsetHandler for Count

Represents the value and new record field value for a date literal

Abstract class for date literal comparison

Factory class for creating DateLiteralComparable instances

Generic date literal parser

DateParser is a parser for date values.

MockDatabaseDMLHandler is used to handle DML operations on the mock database

DynamicCast is a class that provides a method to cast a value to a specified type.

Handles the equality operator

Handles the excludes operator

This class is responsible for parsing a list of fields.

This class is responsible for parsing a field from a query string.

FieldSelectHandler is a class that implements ISelectHandler. It is used to handle the selection of a field.

FieldSelector is a class that is used to select fields from a queried record based on a field node.

This class is responsible for parsing the FOR UPDATE clause in a SOQL query

This class is responsible for parsing the FOR VIEW or FOR REFERENCE clause

Class is responsible for parsing the 'from' clause of a query

Salesforce is insanely inconsistent about dates and date times, this class returns values in GMT

Handles the greater than operator

Handles the greater than or equal operator

This class is responsible for parsing the GROUP BY clause of a SOQL query

This class is used to handle the having clause logic

This class is responsible for parsing the HAVING clause of a SOQL query.

Interface for aggregate calculator

This class is used to compare two fields to determine if one is a reference to the other

Id Field Comparator

Returns a comparator for the given field types, compares ID fields (i.e. ID, Reference)

Interface for limit handler

Handles the includes operator

Handles the inequality operator

Handler for IN operator

: Class to hold the head of a parsed query and the remaining subquery

Interface for offset handler

comparison handlers for WHERE and HAVING clauses

Interface for handling select operations

Strategy inreferace for WHERE logic comparison

Comparable class for LAST_90_DAYS

Comparable for the LAST_FISCAL_YEAR date literal

Comparable class for LAST_MONTH

Comparable class for LAST_N_DAYS

Comparable class for LAST_N_FISCAL_YEARS

Comparable class for LAST_N_WEEKS

Compares a date field to the last quarter

Comparable class for LAST_WEEK

Handles the less than operator

Handles the LessThanOrEqual operator

Handles the LIKE operator

Used to create a limit handler based on the query type

The options to be passed into an ILimitHandler

This class is responsible for parsing the limit clause of a query

calculates the MAX value of a field for an aggregate result

Calculates the minimum value of a field

This class is responsible for handling aggregate SOQL queries to the mock database

This class is responsible for handling count SOQL queries to the mock database

: utilities for a MockDatabase, contains methods that DO NOT mutate the database : a method in here must be dependent on the database, but not necessary to understand : the database

MockDeleteHandler is a class that extends MockDMLHandler and overrides the delete methods to simulate the delete operation

MockDMLHandler is an abstract class that provides a base class for mocking DML operations.

MockInsertHandler is used to mock the insert operation

This class is responsible for handling record SOQL queries to the mock database

Base class for handling SOQL queries to the mock database

MockUndeleteHandler is used to mock the Database.UndeleteResult class and the Database.undelete method

MockUpdateHandler is used to mock the update operation in the database

MockUpsertHandler is used to mock the upsert operation in the database

Comparable class for N_DAYS_AGO

Comparable class for NEXT_90_DAYS

Comparable for the NEXT_FISCAL_YEAR date literal

Comparable class for NEXT_MONTH

Comparable class for NEXT_N_DAYS

Compare the date field value with the NEXT_N_FISCAL_YEARS:N token

Comparable for the NEXT_N_QUARTERS token

Comparable class for NEXT_N_WEEKS

Compares the NEXT_QUARTER token

Comparable class for NEXT_WEEK

Compares a date to N fiscal years ago

Comparable class for N_MONTHS_AGO

: Returns a string representation of the AST

: Builder class for the Node class, used to create a Node

Service class for manipulating and describing the nodes of the AST created by the parser each method is a static method that takes in a TopLevelNodes

This class is responsible for handling the NodeType constants

Handles the NotIn operator

NullParser is a parser for null values.

NumberParser is a parser for numeric values.

This class is used to compare two generic objects of the same type.

This class is responsible for creating the appropriate offset handler based on the query type.

Options class for the Offset class

This class is responsible for parsing the offset clause of a query

Provides a factory for creating operator handlers.

This class is responsible for parsing operators in the query string.

Abstract class for OrderByHandler

Factory class for creating OrderByHandler instances

Options class for OrderBy

This class is responsible for parsing the ORDER BY clause of a SOQL query.

Singleton for the Organization object

Represents a chain of fields to look up on a parent object

A class to resolve a parent lookup chain

A class to store data about a parent record

Handles the selection of a field that is a parent relationship in a subquery

The parser breaks down a SOQL query into an AST, to be fed into the parser (MockDatabase)

Contains utility methods for the parser, could probably be refactored out of existance though

Attributes for polymorphic SObject

Select handler for TYPEOF operator

Factory class for primitive parsers

before we create an aggregate, wean a proto-aggregate, i.e. a Map<String, Object> that will be used to store the aggregate

This class is used to resolve the field in a query

This class is responsible for parsing a SOQL query

Validate the AST of a query, this does not validate the query against the schema, but rather checks for invalid queries that are not supported by the SOQL parser

Limit handler for record limit

Offset handler for records

Order by handler for record data

Comparator for two reference fields, checks if they reference the same object

A class to handle regex operations

This class is used to create success and failure results for DML operations.

this class is intended to handle interactions with the Schema class and provide a layer of abstraction for the Schema class, non-mutating string arguments to these methods are understood to be case-insensitive anything named "getName" are understood to return proper API names every argument is understood to be non-null

This class is responsible for parsing the scope clause of a SOQL query

Factory class to create appropriate select handler based on the field node type

Parser for the SELECT clause

This class is used to compare two SObjects based on the fields provided in the constructor.

Parses an SObject name in a query

This class is response for handling SOQL queries to the mock database

A class to parse a generic string

SubParser is an abstract class that provides helper methods for parsing subqueries.

Calculates the sum of a field

Comparable for the THIS_FISCAL_YEAR token

Comparable class for THIS_MONTH

Comparable class for THIS_QUARTER

Comparable class for THIS_WEEK

Comparable for THIS_YEAR

Comparable class for TODAY

This class is responsible for handling the Token constants

Comparable class for TOMORROW

This class is used to parse the top level nodes of a SOQL query. Designed to refresh the instance if the head node changes, i.e. if a new SOQL query is made.

TypeOf is a class that provides a method to determine the type of an object.

This class is responsible for parsing the UPDATE TRACKING or UPDATE VIEWSTAT query

This class is responsible for parsing a list of values.

This class is responsible for parsing values in the query string

Contains the results of a where logic comparison

This class is responsible for handling date functions in the WHERE clause

This class is responsible for handling the WHERE clause logic

Strategy for getting the field value of a parent field

This class is responsible for handling record fields in the WHERE clause

This class is responsible for parsing the WHERE clause of a SOQL query.

This class is used to parse the WITH DATA CATEGORY clause in a SOQL query

This class is responsible for parsing the WITH SECURITY_ENFORCED clause in a SOQL query.

Comparable class for YESTERDAY