Documentation
¶
Overview ¶
Package query provides SOQL query execution and building.
Index ¶
- type Builder
- func (b *Builder) Build() string
- func (b *Builder) ForReference() *Builder
- func (b *Builder) ForUpdate() *Builder
- func (b *Builder) ForView() *Builder
- func (b *Builder) GroupBy(fields ...string) *Builder
- func (b *Builder) Having(condition string) *Builder
- func (b *Builder) Limit(limit int) *Builder
- func (b *Builder) Offset(offset int) *Builder
- func (b *Builder) OrderByAsc(field string) *Builder
- func (b *Builder) OrderByDesc(field string) *Builder
- func (b *Builder) OrderByNullsFirst(field, direction string) *Builder
- func (b *Builder) OrderByNullsLast(field, direction string) *Builder
- func (b *Builder) Select(fields ...string) *Builder
- func (b *Builder) Where(condition string) *Builder
- func (b *Builder) WhereEquals(field string, value interface{}) *Builder
- func (b *Builder) WhereGreaterThan(field string, value interface{}) *Builder
- func (b *Builder) WhereIn(field string, values ...interface{}) *Builder
- func (b *Builder) WhereLessThan(field string, value interface{}) *Builder
- func (b *Builder) WhereLike(field, pattern string) *Builder
- func (b *Builder) WhereNotEquals(field string, value interface{}) *Builder
- func (b *Builder) WhereNotIn(field string, values ...interface{}) *Builder
- func (b *Builder) WhereNotNull(field string) *Builder
- func (b *Builder) WhereNull(field string) *Builder
- type HTTPClient
- type Result
- type SObject
- type Service
- func (s *Service) Execute(ctx context.Context, query string) (*Result, error)
- func (s *Service) ExecuteAll(ctx context.Context, query string) (*Result, error)
- func (s *Service) ExecuteAllRecords(ctx context.Context, query string) ([]*SObject, error)
- func (s *Service) ExecuteWithCallback(ctx context.Context, query string, fn func(*SObject) error) error
- func (s *Service) NewBuilder(objectType string) *Builder
- func (s *Service) QueryMore(ctx context.Context, nextRecordsURL string) (*Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder provides fluent SOQL query building.
func NewBuilder ¶
NewBuilder creates a new query builder.
func (*Builder) ForReference ¶
ForReference adds FOR REFERENCE.
func (*Builder) OrderByAsc ¶
OrderByAsc adds ascending ORDER BY.
func (*Builder) OrderByDesc ¶
OrderByDesc adds descending ORDER BY.
func (*Builder) OrderByNullsFirst ¶
OrderByNullsFirst adds NULLS FIRST ordering.
func (*Builder) OrderByNullsLast ¶
OrderByNullsLast adds NULLS LAST ordering.
func (*Builder) WhereEquals ¶
WhereEquals adds an equality condition.
func (*Builder) WhereGreaterThan ¶
WhereGreaterThan adds a > condition.
func (*Builder) WhereLessThan ¶
WhereLessThan adds a < condition.
func (*Builder) WhereNotEquals ¶
WhereNotEquals adds a not-equal condition.
func (*Builder) WhereNotIn ¶
WhereNotIn adds a NOT IN condition.
func (*Builder) WhereNotNull ¶
WhereNotNull adds an IS NOT NULL condition.
type HTTPClient ¶
type HTTPClient interface {
Get(ctx context.Context, path string) ([]byte, error)
Post(ctx context.Context, path string, body interface{}) ([]byte, error)
}
HTTPClient interface for dependency injection.
type Result ¶
type Result struct {
TotalSize int `json:"totalSize"`
Done bool `json:"done"`
NextRecordsURL string `json:"nextRecordsUrl,omitempty"`
Records []*SObject `json:"-"`
RawRecords []map[string]interface{} `json:"records"`
}
Result contains SOQL query results.
type SObject ¶
type SObject struct {
// contains filtered or unexported fields
}
SObject represents a query result record.
func (*SObject) StringField ¶
StringField returns a field as string.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides SOQL query operations.
func NewService ¶
func NewService(client HTTPClient, apiVersion string) *Service
NewService creates a new Query service.
func (*Service) ExecuteAll ¶
ExecuteAll runs a SOQL query including deleted/archived records.
func (*Service) ExecuteAllRecords ¶
ExecuteAll fetches all records across pagination.
func (*Service) ExecuteWithCallback ¶
func (s *Service) ExecuteWithCallback(ctx context.Context, query string, fn func(*SObject) error) error
ExecuteWithCallback executes a query and calls fn for each record.
func (*Service) NewBuilder ¶
NewBuilder creates a new SOQL query builder.