Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyEvent(ctx context.Context, tx *sqlx.Tx, org *OrgAssets, session *Session, ...) error
- func ApplyMsgCreatedEvent(ctx context.Context, tx *sqlx.Tx, org *OrgAssets, session *Session, ...) error
- func LoadContact(o *OrgAssets, id ContactID) (*flows.Contact, error)
- func MarkCampaignEventFired(ctx context.Context, db *sqlx.DB, fireID int, fired time.Time) error
- func MarkMessagesQueued(ctx context.Context, db *sqlx.DB, msgs []*Msg) error
- type ChannelID
- type ConnectionID
- type ContactID
- type ContactURNID
- type ExitType
- type FlowDefinition
- type FlowID
- type FlowRun
- type Msg
- type MsgDirection
- type MsgID
- type MsgStatus
- type MsgType
- type MsgVisibility
- type OrgAssets
- func (o *OrgAssets) GetActiveTopup() (TopUpID, error)
- func (o *OrgAssets) GetChannel(uuid flows.ChannelUUID) (flows.Channel, error)
- func (o *OrgAssets) GetChannelID(uuid flows.ChannelUUID) (ChannelID, error)
- func (o *OrgAssets) GetChannelSet() (*flows.ChannelSet, error)
- func (o *OrgAssets) GetField(key string) (*flows.Field, error)
- func (o *OrgAssets) GetFieldSet() (*flows.FieldSet, error)
- func (o *OrgAssets) GetFlow(uuid flows.FlowUUID) (flows.Flow, error)
- func (o *OrgAssets) GetFlowID(uuid flows.FlowUUID) (FlowID, error)
- func (o *OrgAssets) GetGroup(uuid flows.GroupUUID) (*flows.Group, error)
- func (o *OrgAssets) GetGroupSet() (*flows.GroupSet, error)
- func (o *OrgAssets) GetLabel(uuid flows.LabelUUID) (*flows.Label, error)
- func (o *OrgAssets) GetLabelSet() (*flows.LabelSet, error)
- func (o *OrgAssets) GetLocationHierarchySet() (*flows.LocationHierarchySet, error)
- func (o *OrgAssets) GetOrgID() OrgID
- func (o *OrgAssets) GetResthookSet() (*flows.ResthookSet, error)
- func (o *OrgAssets) HasLocations() bool
- type OrgID
- type Session
- type SessionID
- type SessionStatus
- type Step
- type TopUpID
Constants ¶
View Source
const StatusPending = MsgStatus("P")
View Source
const StatusQueued = MsgStatus("Q")
Variables ¶
View Source
var ( ExitInterrupted = null.NewString("I", true) ExitCompleted = null.NewString("C", true) ExitExpired = null.NewString("E", true) )
Functions ¶
func ApplyEvent ¶
func ApplyMsgCreatedEvent ¶
func LoadContact ¶
LoadContact loads a contact for the passed in contact id and org assets
func MarkCampaignEventFired ¶
Types ¶
type ConnectionID ¶
type ContactURNID ¶
type ContactURNID int
type FlowDefinition ¶
type FlowRun ¶
type FlowRun struct { ID FlowID `db:"id"` UUID flows.RunUUID `db:"uuid"` IsActive bool `db:"is_active"` CreatedOn time.Time `db:"created_on"` ModifiedOn time.Time `db:"modified_on"` ExitedOn *time.Time `db:"exited_on"` ExitType null.String `db:"exit_type"` ExpiresOn *time.Time `db:"expires_on"` TimeoutOn *time.Time `db:"timeout_on"` Responded bool `db:"responded"` // TODO: should this be a complex object that can read / write iself to the DB as JSON? Results string `db:"results"` // TODO: should this be a complex object that can read / write iself to the DB as JSON? Path string `db:"path"` // TODO: should this be a complex object that can read / write iself to the DB as JSON? Events string `db:"events"` CurrentNodeUUID flows.NodeUUID `db:"current_node_uuid"` ContactID int `db:"contact_id"` FlowID FlowID `db:"flow_id"` OrgID OrgID `db:"org_id"` ParentID null.Int `db:"parent_id"` SessionID SessionID `db:"session_id"` StartID null.Int `db:"start_id"` }
type Msg ¶
type Msg struct { ID MsgID `db:"id" json:"id"` UUID flows.MsgUUID `db:"uuid" json:"uuid"` Text string `db:"text" json:"text"` HighPriority bool `db:"high_priority" json:"high_priority"` CreatedOn time.Time `db:"created_on" json:"created_on"` ModifiedOn time.Time `db:"modified_on" json:"modified_on"` SentOn time.Time `db:"sent_on" json:"sent_on"` QueuedOn time.Time `db:"queued_on" json:"queued_on"` Direction MsgDirection `db:"direction" json:"direction"` Status MsgStatus `db:"status" json:"status"` Visibility MsgVisibility `db:"visibility" json:"visibility"` MsgType MsgType `db:"msg_type"` MsgCount int `db:"msg_count" json:"tps_cost"` ErrorCount int `db:"error_count" json:"error_count"` NextAttempt time.Time `db:"next_attempt" json:"next_attempt"` ExternalID null.String `db:"external_id" json:"external_id"` Attachments []string `db:"attachments" json:"attachments"` Metadata null.String `db:"metadata" json:"metadata"` ChannelID ChannelID `db:"channel_id" json:"channel_id"` ChannelUUID flows.ChannelUUID ` json:"channel_uuid"` ConnectionID ConnectionID `db:"connection_id"` ContactID ContactID `db:"contact_id" json:"contact_id"` ContactURNID ContactURNID `db:"contact_urn_id" json:"contact_urn_id"` URN urns.URN ` json:"urn"` OrgID OrgID `db:"org_id" json:"org_id"` TopUpID TopUpID `db:"topup_id"` }
type MsgDirection ¶
type MsgDirection string
type MsgVisibility ¶
type MsgVisibility string
type OrgAssets ¶
type OrgAssets struct {
// contains filtered or unexported fields
}
OrgAssets is the set of assets for an organization. These are loaded lazily from the database as asked for. OrgAssets are thread safe and can be shared across goroutines. OrgAssets implement the flows.SessionAssets interface.
func (*OrgAssets) GetActiveTopup ¶
TODO: does this need to be optimized further?
func (*OrgAssets) GetChannel ¶
func (*OrgAssets) GetChannelID ¶
func (o *OrgAssets) GetChannelID(uuid flows.ChannelUUID) (ChannelID, error)
func (*OrgAssets) GetChannelSet ¶
func (o *OrgAssets) GetChannelSet() (*flows.ChannelSet, error)
func (*OrgAssets) GetLocationHierarchySet ¶
func (o *OrgAssets) GetLocationHierarchySet() (*flows.LocationHierarchySet, error)
func (*OrgAssets) GetResthookSet ¶
func (o *OrgAssets) GetResthookSet() (*flows.ResthookSet, error)
func (*OrgAssets) HasLocations ¶
type Session ¶
type Session struct { ID SessionID `db:"id"` Status SessionStatus `db:"status"` Responded bool `db:"responded"` Output string `db:"output"` ContactID ContactID `db:"contact_id"` OrgID OrgID `db:"org_id"` CreatedOn time.Time // contains filtered or unexported fields }
func CreateSession ¶
func CreateSession(ctx context.Context, tx *sqlx.Tx, org *OrgAssets, s flows.Session) (*Session, error)
CreateSession writes the passed in session to our database, writes any runs that need to be created as well as appying any events created in the session
func (*Session) AddFlowIDMapping ¶
func (*Session) AddOutboxMsg ¶
type SessionStatus ¶
type SessionStatus string
Click to show internal directories.
Click to hide internal directories.