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

package bulk

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


Package Files

bulk.go formatter.go job.go jobs.go mock_session_formatter.go

type ColumnDelimiter Uses

type ColumnDelimiter string

ColumnDelimiter is the column delimiter used for CSV job data.

const (
    // Backquote is the (`) character.
    Backquote ColumnDelimiter = "BACKQUOTE"
    // Caret is the (^) character.
    Caret ColumnDelimiter = "CARET"
    // Comma is the (,) character.
    Comma ColumnDelimiter = "COMMA"
    // Pipe is the (|) character.
    Pipe ColumnDelimiter = "PIPE"
    // SemiColon is the (;) character.
    SemiColon ColumnDelimiter = "SEMICOLON"
    // Tab is the (\t) character.
    Tab ColumnDelimiter = "TAB"

type ContentType Uses

type ContentType string

ContentType is the format of the data being processed.

const CSV ContentType = "CSV"

CSV is the supported content data type.

type FailedRecord Uses

type FailedRecord struct {
    Error string

FailedRecord indicates why the record failed and the data of the record.

type Formatter Uses

type Formatter struct {
    // contains filtered or unexported fields

Formatter is the object that will add records for the bulk uploader.

func NewFormatter Uses

func NewFormatter(job *Job, fields []string) (*Formatter, error)

NewFormatter creates a new formatter using the job and the list of fields.

func (*Formatter) Add Uses

func (f *Formatter) Add(records ...Record) error

Add will place a record in the bulk uploader.

func (*Formatter) Reader Uses

func (f *Formatter) Reader() *strings.Reader

Reader will return a reader of the bulk uploader field record body.

type Info Uses

type Info struct {
    ApexProcessingTime      int    `json:"apexProcessingTime"`
    APIActiveProcessingTime int    `json:"apiActiveProcessingTime"`
    NumberRecordsFailed     int    `json:"numberRecordsFailed"`
    NumberRecordsProcessed  int    `json:"numberRecordsProcessed"`
    Retries                 int    `json:"retries"`
    TotalProcessingTime     int    `json:"totalProcessingTime"`
    ErrorMessage            string `json:"errorMessage"`

Info is the response to the job information API.

type Job Uses

type Job struct {
    // contains filtered or unexported fields

Job is the bulk job.

func (*Job) Abort Uses

func (j *Job) Abort() (Response, error)

Abort will abort the current job.

func (*Job) Close Uses

func (j *Job) Close() (Response, error)

Close will close the current job.

func (*Job) Delete Uses

func (j *Job) Delete() error

Delete will delete the current job.

func (*Job) FailedRecords Uses

func (j *Job) FailedRecords() ([]FailedRecord, error)

FailedRecords returns the failed records for the job.

func (*Job) Info Uses

func (j *Job) Info() (Info, error)

Info returns the current job information.

func (*Job) SuccessfulRecords Uses

func (j *Job) SuccessfulRecords() ([]SuccessfulRecord, error)

SuccessfulRecords returns the successful records for the job.

func (*Job) UnprocessedRecords Uses

func (j *Job) UnprocessedRecords() ([]UnprocessedRecord, error)

UnprocessedRecords returns the unprocessed records for the job.

func (*Job) Upload Uses

func (j *Job) Upload(body io.Reader) error

Upload will upload data to processing.

type JobRecord Uses

type JobRecord struct {
    ID  string

JobRecord is the record for the job. Includes the Salesforce ID along with the fields.

type JobType Uses

type JobType string

JobType is the bulk job type.

const (
    // BigObjects is the big objects job.
    BigObjects JobType = "BigObjectIngest"
    // Classic is the bulk job 1.0.
    Classic JobType = "Classic"
    // V2Ingest is the bulk job 2.0.
    V2Ingest JobType = "V2Ingest"

type Jobs Uses

type Jobs struct {
    // contains filtered or unexported fields

Jobs presents the response from the all jobs request.

func (*Jobs) Done Uses

func (j *Jobs) Done() bool

Done indicates whether there are more jobs to get.

func (*Jobs) Next Uses

func (j *Jobs) Next() (*Jobs, error)

Next will retrieve the next batch of job information.

func (*Jobs) Records Uses

func (j *Jobs) Records() []Response

Records contains the information for each retrieved job.

type LineEnding Uses

type LineEnding string

LineEnding is the line ending used for the CSV job data.

const (
    // Linefeed is the (\n) character.
    Linefeed LineEnding = "LF"
    // CarriageReturnLinefeed is the (\r\n) character.
    CarriageReturnLinefeed LineEnding = "CRLF"

type Operation Uses

type Operation string

Operation is the processing operation for the job.

const (
    // Insert is the object operation for inserting records.
    Insert Operation = "insert"
    // Delete is the object operation for deleting records.
    Delete Operation = "delete"
    // Update is the object operation for updating records.
    Update Operation = "update"
    // Upsert is the object operation for upserting records.
    Upsert Operation = "upsert"

type Options Uses

type Options struct {
    ColumnDelimiter     ColumnDelimiter `json:"columnDelimiter"`
    ContentType         ContentType     `json:"contentType"`
    ExternalIDFieldName string          `json:"externalIdFieldName"`
    LineEnding          LineEnding      `json:"lineEnding"`
    Object              string          `json:"object"`
    Operation           Operation       `json:"operation"`

Options are the options for the job.

ColumnDelimiter is the delimiter used for the CSV job. This field is optional.

ContentType is the content type for the job. This field is optional.

ExternalIDFieldName is the external ID field in the object being updated. Only needed for upsert operations. This field is required for upsert operations.

LineEnding is the line ending used for the CSV job data. This field is optional.

Object is the object type for the data bneing processed. This field is required.

Operation is the processing operation for the job. This field is required.

type Parameters Uses

type Parameters struct {
    IsPkChunkingEnabled bool
    JobType             JobType

Parameters to query all of the bulk jobs.

IsPkChunkingEnabled will filter jobs with PK chunking enabled.

JobType will filter jobs based on job type.

type Record Uses

type Record interface {
    Fields() map[string]interface{}
    InsertNull() bool

Record is the interface to the fields of the bulk uploader record.

type Resource Uses

type Resource struct {
    // contains filtered or unexported fields

Resource is the structure that can be used to create bulk 2.0 jobs.

func NewResource Uses

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

NewResource creates a new bulk 2.0 REST resource. If the session is nil an error will be returned.

func (*Resource) AllJobs Uses

func (r *Resource) AllJobs(parameters Parameters) (*Jobs, error)

AllJobs will retrieve all of the bulk 2.0 jobs.

func (*Resource) CreateJob Uses

func (r *Resource) CreateJob(options Options) (*Job, error)

CreateJob will create a new bulk 2.0 job from the options that where passed. The Job that is returned can be used to upload object data to the Salesforce org.

type Response Uses

type Response struct {
    APIVersion          float32 `json:"apiVersion"`
    ColumnDelimiter     string  `json:"columnDelimiter"`
    ConcurrencyMode     string  `json:"concurrencyMode"`
    ContentType         string  `json:"contentType"`
    ContentURL          string  `json:"contentUrl"`
    CreatedByID         string  `json:"createdById"`
    CreatedDate         string  `json:"createdDate"`
    ExternalIDFieldName string  `json:"externalIdFieldName"`
    ID                  string  `json:"id"`
    JobType             string  `json:"jobType"`
    LineEnding          string  `json:"lineEnding"`
    Object              string  `json:"object"`
    Operation           string  `json:"operation"`
    State               string  `json:"state"`
    SystemModstamp      string  `json:"systemModstamp"`

Response is the response to job APIs.

type State Uses

type State string

State is the current state of processing for the job.

const (
    // Open the job has been created and job data can be uploaded tothe job.
    Open State = "Open"
    // UpdateComplete all data for the job has been uploaded and the job is ready to be queued and processed.
    UpdateComplete State = "UploadComplete"
    // Aborted the job has been aborted.
    Aborted State = "Aborted"
    // JobComplete the job was processed by Salesforce.
    JobComplete State = "JobComplete"
    // Failed some records in the job failed.
    Failed State = "Failed"

type SuccessfulRecord Uses

type SuccessfulRecord struct {
    Created bool

SuccessfulRecord indicates for the record was created and the data that was uploaded.

type UnprocessedRecord Uses

type UnprocessedRecord struct {
    Fields map[string]string

UnprocessedRecord is the unprocessed records from the job.

Package bulk imports 11 packages (graph). Updated 2019-06-22. Refresh now. Tools for package owners.