go-sfdc: github.com/g8rswimmer/go-sfdc/soql Index | Files

package soql

import "github.com/g8rswimmer/go-sfdc/soql"


Package Files

formatter.go mock_session_formatter.go query.go record.go response.go result.go

type OrderBy Uses

type OrderBy struct {
    // contains filtered or unexported fields

OrderBy is the ordering structure of the SOQL query.

func NewOrderBy Uses

func NewOrderBy(result OrderResult) (*OrderBy, error)

NewOrderBy creates an OrderBy structure. If the order results is not ASC or DESC, an error will be returned.

func (*OrderBy) FieldOrder Uses

func (o *OrderBy) FieldOrder(fields ...string)

FieldOrder is a list of fields in the ordering.

func (*OrderBy) NullOrdering Uses

func (o *OrderBy) NullOrdering(nulls OrderNulls) error

NullOrdering sets the ordering, first or last, of the null values.

func (*OrderBy) Order Uses

func (o *OrderBy) Order() (string, error)

Order returns the order by SOQL string.

type OrderNulls Uses

type OrderNulls string

OrderNulls is where the null values are placed in the ordering.

const (
    // OrderNullsLast places the null values at the end of the ordering.
    OrderNullsLast OrderNulls = "NULLS LAST"
    // OrderNullsFirst places the null values at the start of the ordering.
    OrderNullsFirst OrderNulls = "NULLS FIRST"

type OrderResult Uses

type OrderResult string

OrderResult is the type of ordering of the query result.

const (
    // OrderAsc will place the results in ascending order.
    OrderAsc OrderResult = "ASC"
    // OrderDesc will place the results in descending order.
    OrderDesc OrderResult = "DESC"

type Orderer Uses

type Orderer interface {
    Order() (string, error)

Orderer is the interface for returning the SOQL ordering.

type Query Uses

type Query struct {
    // contains filtered or unexported fields

Query is the struture used to build a SOQL query.

func NewQuery Uses

func NewQuery(input QueryInput) (*Query, error)

NewQuery creates a new builder. If the object is an empty string, then an error is returned.

func (*Query) Format Uses

func (b *Query) Format() (string, error)

Format will return the SOQL query. If the builder has an empty string or the field list is zero, an error is returned.

type QueryFormatter Uses

type QueryFormatter interface {
    Format() (string, error)

QueryFormatter is the interface to return the SOQL query.

Format returns the SOQL query.

type QueryInput Uses

type QueryInput struct {
    FieldList  []string
    ObjectType string
    SubQuery   []QueryFormatter
    Where      WhereClauser
    Order      Orderer
    Limit      int
    Offset     int

QueryInput is used to provide SOQL inputs.

ObjectType is the Salesforce Object, like Account

FieldList is the Salesforce Object's fields to query

SubQuery is the inner query

Where is the SOQL where cause

Order is the SOQL ordering

Limit is the SOQL record limit

Offset is the SOQL record offset

type QueryRecord Uses

type QueryRecord struct {
    // contains filtered or unexported fields

QueryRecord is the result of the SOQL record. If the query statement contains an inner query, there will be a group of subresults.

func (*QueryRecord) Record Uses

func (rec *QueryRecord) Record() *sfdc.Record

Record returns the SOQL record.

func (*QueryRecord) Subresult Uses

func (rec *QueryRecord) Subresult(sub string) (*QueryResult, bool)

Subresult returns a specific inner query result.

func (*QueryRecord) Subresults Uses

func (rec *QueryRecord) Subresults() map[string]*QueryResult

Subresults returns all of the inner query results.

type QueryResult Uses

type QueryResult struct {
    // contains filtered or unexported fields

QueryResult is returned from the SOQL query. This will allow for retrieving all of the records and query the next round of records if available.

func (*QueryResult) Done Uses

func (result *QueryResult) Done() bool

Done will indicate if the result does not contain any more records.

func (*QueryResult) MoreRecords Uses

func (result *QueryResult) MoreRecords() bool

MoreRecords will indicate if the remaining records require another Saleforce service callout.

func (*QueryResult) Next Uses

func (result *QueryResult) Next() (*QueryResult, error)

Next will query the next set of records.

func (*QueryResult) Records Uses

func (result *QueryResult) Records() []*QueryRecord

Records returns the records from the query request.

func (*QueryResult) TotalSize Uses

func (result *QueryResult) TotalSize() int

TotalSize is the total size of the query result. This may or may not be the size of the records in the result.

type Resource Uses

type Resource struct {
    // contains filtered or unexported fields

Resource is the structure for the Salesforce SOQL API resource.

func NewResource Uses

func NewResource(session session.ServiceFormatter) (*Resource, error)

NewResource forms the Salesforce SOQL resource. The session formatter is required to form the proper URLs and authorization header.

func (*Resource) Query Uses

func (r *Resource) Query(querier QueryFormatter, all bool) (*QueryResult, error)

Query will call out to the Salesforce org for a SOQL. The results will be the result of the query. The all parameter is for querying all records, which include deleted records that are in the recycle bin.

type WhereClause Uses

type WhereClause struct {
    // contains filtered or unexported fields

WhereClause is the structure that will contain a SOQL where clause.

func WhereEquals Uses

func WhereEquals(field string, value interface{}) (*WhereClause, error)

WhereEquals forms the equals where expression.

func WhereGreaterThan Uses

func WhereGreaterThan(field string, value interface{}, equals bool) (*WhereClause, error)

WhereGreaterThan will form the greater or equal than expression. If the value is a string or boolean, an error is returned.

func WhereIn Uses

func WhereIn(field string, values []interface{}) (*WhereClause, error)

WhereIn forms the field in a set expression.

func WhereLessThan Uses

func WhereLessThan(field string, value interface{}, equals bool) (*WhereClause, error)

WhereLessThan will form the less or equal than expression. If the value is a string or boolean, an error is returned.

func WhereLike Uses

func WhereLike(field string, value string) (*WhereClause, error)

WhereLike will form the LIKE expression.

func WhereNotEquals Uses

func WhereNotEquals(field string, value interface{}) (*WhereClause, error)

WhereNotEquals forms the not equals where expression.

func WhereNotIn Uses

func WhereNotIn(field string, values []interface{}) (*WhereClause, error)

WhereNotIn forms the field is not in a set expression.

func (*WhereClause) And Uses

func (wc *WhereClause) And(where WhereExpression)

And will logical AND the expressions.

func (*WhereClause) Clause Uses

func (wc *WhereClause) Clause() string

Clause returns the where cluase.

func (*WhereClause) Expression Uses

func (wc *WhereClause) Expression() string

Expression will return the where expression.

func (*WhereClause) Group Uses

func (wc *WhereClause) Group()

Group will form a grouping around the expression.

func (*WhereClause) Or Uses

func (wc *WhereClause) Or(where WhereExpression)

Or will logical OR the expressions.

type WhereClauser Uses

type WhereClauser interface {
    Clause() string

WhereClauser is an interface to return the where cause.

type WhereExpression Uses

type WhereExpression interface {
    Expression() string

WhereExpression is an interface to return the where cause's expression.

Package soql imports 9 packages (graph). Updated 2019-09-04. Refresh now. Tools for package owners.