sobjects

package
v0.0.0-...-2a1b41a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFieldNames

func ConvertFieldNames(obj interface{}, jsonFields string) string

ConvertFieldNames takes in any interface that inplements SObject and a comma separated list of json field names. It converts the json field names to the force struct tag stated equivalent.

Types

type Account

type Account struct {
	BaseSObject
	BillingCity       string `force:",omitempty"`
	BillingCountry    string `force:",omitempty"`
	BillingPostalCode string `force:",omitempty"`
	BillingState      string `force:",omitempty"`
	BillingStreet     string `force:",omitempty"`
}

func (Account) ApiName

func (a Account) ApiName() string

type BaseQuery

type BaseQuery struct {
	Done           bool    `json:"Done" force:"done"`
	TotalSize      float64 `json:"TotalSize" force:"totalSize"`
	NextRecordsUri string  `json:"NextRecordsUrl" force:"nextRecordsUrl"`
}

Fields that are returned in every query response. Use this to build custom structs.

type MyCustomQueryResponse struct {
	BaseQuery
	Records []sobjects.Account `json:"records" force:"records"`
}

type BaseSObject

type BaseSObject struct {
	Attributes       SObjectAttributes `force:"attributes,omitempty" json:"-"`
	Id               string            `force:",omitempty" json:",omitempty"`
	IsDeleted        bool              `force:",omitempty" json:",omitempty"`
	Name             string            `force:",omitempty" json:",omitempty"`
	CreatedDate      string            `force:",omitempty" json:",omitempty"`
	CreatedById      string            `force:",omitempty" json:",omitempty"`
	LastModifiedDate string            `force:",omitempty" json:",omitempty"`
	LastModifiedById string            `force:",omitempty" json:",omitempty"`
	SystemModstamp   string            `force:",omitempty" json:",omitempty"`
}

Base struct that contains fields that all objects, standard and custom, include.

func (BaseSObject) ExternalIdApiName

func (b BaseSObject) ExternalIdApiName() string

Implementing this here because most objects don't have an external id and as such this is not needed. Feel free to override this function when embedding the BaseSObject in other structs.

type Lead

type Lead struct {
	BaseSObject
	Company       string `force:",omitempty"`
	ConvertedDate string `force:",omitempty"`
	Email         string `force:",omitempty"`
	FirstName     string `force:",omitempty"`
	IsConverted   bool   `force:",omitempty"`
	IsDeleted     bool   `force:",omitempty"`
	LastName      string `force:",omitempty"`
	OwnerId       string `force:",omitempty"`
	Status        string `force:",omitempty"`
}

func (*Lead) ApiName

func (t *Lead) ApiName() string

type LeadQueryResponse

type LeadQueryResponse struct {
	BaseQuery
	Records []Lead `json:"Records" force:"records"`
}

type Opportunity

type Opportunity struct {
	BaseSObject
	AccountId       string  `force:",omitempty"`
	Amount          float64 `force:",omitempty"`
	CloseDate       string  `force:",omitempty"`
	CurrencyIsoCode string  `force:",omitempty"`
	Description     string  `force:",omitempty"`
	ExpectedRevenue string  `force:",omitempty"`
	IsClosed        bool    `force:",omitempty"`
	IsDeleted       bool    `force:",omitempty"`
	IsSplit         bool    `force:",omitempty"`
	IsWon           bool    `force:",omitempty"`
	Name            string  `force:",omitempty"`
	OwnerId         string  `force:",omitempty"`
	StageName       string  `force:",omitempty"`
}

func (*Opportunity) ApiName

func (t *Opportunity) ApiName() string

type OpportunityQueryResponse

type OpportunityQueryResponse struct {
	BaseQuery
	Records []Opportunity `json:"Records" force:"records"`
}

type Profile

type Profile struct {
	BaseSObject
	Description               string `force:",omitempty"`
	IsSsoEnabled              bool   `force:",omitempty"`
	LastReferencedDate        string `force:",omitempty"`
	LastViewedDate            string `force:",omitempty"`
	Name                      string `force:",omitempty"`
	PermissionsPermissionName bool   `force:",omitempty"`
	UserLicenseId             string `force:",omitempty"`
	UserType                  string `force:",omitempty"`
}

func (*Profile) ApiName

func (t *Profile) ApiName() string

type ProfileQueryResponse

type ProfileQueryResponse struct {
	BaseQuery
	Records []Profile `json:"Records" force:"records"`
}

type SFBool

type SFBool int

Don't use this! It was an interesting effort but in reality all you need is a ptr to a bool. *bool will solve all your problems. :) Used to represent empty bools. Go types are always instantiated with a default value, for bool the default value is false. This makes it difficult to update an SObject without overwriting any boolean field to false. This package solves the issue by representing a bool as an int and implementing the marshal/unmarshal json interface. It is a drop in replacement for the bool type. 1 is true 0 is nil -1 is false Unmarshalling: false will be unmarshalled to -1, true will be unmarshalled to 1 If no value is set the unmarshaller will skip the field and the int will default to 0. Marshalling: -1 will be marshaled to false, 1 will be marshaled to true, and 0 will be marshaled to nothing (assuming the field has the omitempty json tag `json:",omitempty"`)

func (*SFBool) Bool

func (t *SFBool) Bool() bool

func (*SFBool) MarshalJSON

func (t *SFBool) MarshalJSON() ([]byte, error)

func (*SFBool) UnmarshalJSON

func (t *SFBool) UnmarshalJSON(data []byte) error

type SObjectAttributes

type SObjectAttributes struct {
	Type string `force:"type,omitempty"`
	Url  string `force:"url,omitempty"`
}

type User

type User struct {
	BaseSObject
	Alias             string `force:",omitempty"`
	CommunityNickname string `force:",omitempty"`
	Email             string `force:",omitempty"`
	EmailEncodingKey  string `force:",omitempty"`
	FirstName         string `force:",omitempty"`
	FullPhotoUrl      string `force:",omitempty"`
	LanguageLocaleKey string `force:",omitempty"`
	LastName          string `force:",omitempty"`
	LocaleSidKey      string `force:",omitempty"`
	ProfileId         string `force:",omitempty"`
	SmallPhotoUrl     string `force:",omitempty"`
	TimeZoneSidKey    string `force:",omitempty"`
	Username          string `force:",omitempty"`
}

func (*User) ApiName

func (t *User) ApiName() string

type UserQueryResponse

type UserQueryResponse struct {
	BaseQuery
	Records []User `json:"Records" force:"records"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL