Documentation ¶
Overview ¶
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"`)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertFieldNames ¶
ConvertFieldNames takes in any interface that inplements SObject and a comma seperated list of json field names. It converts the json field names to the force struct tag stated equivalent.
Types ¶
type Account ¶
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"` FirstName string `force:",omitempty"` IsConverted bool `force:",omitempty"` IsDeleted bool `force:",omitempty"` LastName string `force:",omitempty"` OwnerId string `force:",omitempty"` Status string `force:",omitempty"` }
type LeadQueryResponse ¶
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"` }
type ProfileQueryResponse ¶
type SObjectAttributes ¶
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"` }