feed

package
v0.0.0-...-8883774 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const IgnoreMediaHypertextReference = "media_hypertext_reference"

Variables

This section is empty.

Functions

func DrainAccountActivityHistoryLog

func DrainAccountActivityHistoryLog(ctx context.Context, apiClient *httpapi.Client, req *httpapi.GetAccountsActivityLogRequestParams, feedFn func(*httpapi.GetAccountsActivityLogResponse) error) error

DrainAccountActivityHistoryLog cycle through GetAccountsActivityLogResponse and adapts the filter while there is a next page

func DrainFeed

func DrainFeed(ctx context.Context, apiClient *httpapi.Client, request *GetFeedRequest, feedFn func(*GetFeedResponse) error) error

DrainFeed fetches the data in batches and triggers the callback for each batch.

func GetDatabase

func GetDatabase(dialect string, connectionString string) (*gorm.DB, error)

GetDatabase validates the db credentials and return a DB connection

func GetWaitTime

func GetWaitTime(retryTimeout int) time.Duration

GetWaitTime - Default wait time is 1 second otherwise specified timeout/15. Can't be more than 4 seconds.

Types

type Action

type Action struct {
	ID              string     `json:"id" csv:"action_id" gorm:"primarykey;column:action_id;size:36"`
	Title           string     `json:"title" csv:"title"`
	Description     string     `json:"description" csv:"description"`
	SiteID          string     `json:"site_id" csv:"site_id" gorm:"size:41"`
	Priority        string     `json:"priority" csv:"priority" gorm:"size:20"`
	Status          string     `json:"status" csv:"status" gorm:"size:20"`
	DueDate         time.Time  `json:"due_date" csv:"due_date"`
	CreatedAt       time.Time  `json:"created_at" csv:"created_at"`
	ModifiedAt      time.Time  `json:"modified_at" csv:"modified_at" gorm:"index:idx_act_modified_at,sort:desc"`
	ExportedAt      time.Time  `json:"exported_at" csv:"exported_at" gorm:"index:idx_act_modified_at;autoUpdateTime"`
	CreatorUserID   string     `json:"creator_user_id" csv:"creator_user_id" gorm:"size:37"`
	CreatorUserName string     `json:"creator_user_name" csv:"creator_user_name"`
	TemplateID      string     `json:"template_id" csv:"template_id" gorm:"size:100"`
	AuditID         string     `json:"audit_id" csv:"audit_id" gorm:"size:100"`
	AuditTitle      string     `json:"audit_title" csv:"audit_title"`
	AuditItemID     string     `json:"audit_item_id" csv:"audit_item_id" gorm:"size:100"`
	AuditItemLabel  string     `json:"audit_item_label" csv:"audit_item_label"`
	OrganisationID  string     `json:"organisation_id" csv:"organisation_id" gorm:"index:idx_act_modified_at;size:37"`
	CompletedAt     *time.Time `json:"completed_at" csv:"completed_at"`
	ActionLabel     string     `json:"action_label" csv:"action_label"`
	Deleted         bool       `json:"deleted" csv:"deleted"`
	AssetID         string     `json:"asset_id" csv:"asset_id" gorm:"size:36"`
	UniqueID        string     `json:"unique_id" csv:"unique_id"`
}

Action represents a row from the actions feed

type ActionAssignee

type ActionAssignee struct {
	ID             string    `json:"id" csv:"id" gorm:"primarykey;size:375"`
	ActionID       string    `json:"action_id" csv:"action_id" gorm:"index:idx_act_action_id;size:36"`
	AssigneeID     string    `json:"assignee_id" csv:"assignee_id" gorm:"size:256"`
	Type           string    `json:"type" csv:"type" gorm:"size:10"`
	Name           string    `json:"name" csv:"name"`
	OrganisationID string    `json:"organisation_id" csv:"organisation_id" gorm:"index:idx_act_asg_modified_at;size:37"`
	ModifiedAt     time.Time `json:"modified_at" csv:"modified_at" gorm:"index:idx_act_asg_modified_at,sort:desc"`
	ExportedAt     time.Time `json:"exported_at" csv:"exported_at" gorm:"index:idx_act_asg_modified_at;autoUpdateTime"`
}

ActionAssignee represents a row from the action_assignees feed

type ActionAssigneeFeed

type ActionAssigneeFeed struct {
	ModifiedAfter time.Time
	Incremental   bool
}

ActionAssigneeFeed is a representation of the action_assignees feed

func (*ActionAssigneeFeed) Columns

func (f *ActionAssigneeFeed) Columns() []string

Columns returns the columns of the row

func (*ActionAssigneeFeed) CreateSchema

func (f *ActionAssigneeFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*ActionAssigneeFeed) Export

func (f *ActionAssigneeFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*ActionAssigneeFeed) HasRemainingInformation

func (f *ActionAssigneeFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*ActionAssigneeFeed) Model

func (f *ActionAssigneeFeed) Model() interface{}

Model returns the model of the feed row

func (*ActionAssigneeFeed) Name

func (f *ActionAssigneeFeed) Name() string

Name is the name of the feed

func (*ActionAssigneeFeed) Order

func (f *ActionAssigneeFeed) Order() string

Order returns the ordering when retrieving an export

func (*ActionAssigneeFeed) PrimaryKey

func (f *ActionAssigneeFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*ActionAssigneeFeed) RowsModel

func (f *ActionAssigneeFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type ActionFeed

type ActionFeed struct {
	ModifiedAfter time.Time
	Incremental   bool
	Limit         int
}

ActionFeed is a representation of the actions feed

func (*ActionFeed) Columns

func (f *ActionFeed) Columns() []string

Columns returns the columns of the row

func (*ActionFeed) CreateSchema

func (f *ActionFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*ActionFeed) Export

func (f *ActionFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*ActionFeed) HasRemainingInformation

func (f *ActionFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*ActionFeed) Model

func (f *ActionFeed) Model() interface{}

Model returns the model of the feed row

func (*ActionFeed) Name

func (f *ActionFeed) Name() string

Name is the name of the feed

func (*ActionFeed) Order

func (f *ActionFeed) Order() string

Order returns the ordering when retrieving an export

func (*ActionFeed) PrimaryKey

func (f *ActionFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*ActionFeed) RowsModel

func (f *ActionFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type ActionTimelineItem

type ActionTimelineItem struct {
	ID              string    `json:"id" csv:"item_id" gorm:"primarykey;column:item_id;size:36"`
	TaskID          string    `json:"task_id" csv:"task_id"`
	OrganisationID  string    `json:"organisation_id" csv:"organisation_id"`
	TaskCreatorID   string    `json:"task_creator_id" csv:"task_creator_id"`
	TaskCreatorName string    `json:"task_creator_name" csv:"task_creator_name"`
	Timestamp       time.Time `json:"timestamp" csv:"timestamp" gorm:"index:idx_act_tim_timestamp,sort:desc"`
	CreatorID       string    `json:"creator_id" csv:"creator_id"`
	CreatorName     string    `json:"creator_name" csv:"creator_name"`
	ItemType        string    `json:"item_type" csv:"item_type"`
	ItemData        string    `json:"item_data" csv:"item_data"`
}

ActionTimelineItem represents a row from the action timeline items feed

type ActionTimelineItemFeed

type ActionTimelineItemFeed struct {
	ModifiedAfter time.Time
	Limit         int
	Incremental   bool
}

ActionTimelineItemFeed is a representation of the action timeline items feed

func (*ActionTimelineItemFeed) Columns

func (f *ActionTimelineItemFeed) Columns() []string

Columns returns the columns of the row

func (*ActionTimelineItemFeed) CreateSchema

func (f *ActionTimelineItemFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*ActionTimelineItemFeed) Export

func (f *ActionTimelineItemFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*ActionTimelineItemFeed) HasRemainingInformation

func (f *ActionTimelineItemFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*ActionTimelineItemFeed) Model

func (f *ActionTimelineItemFeed) Model() interface{}

Model returns the model of the feed row

func (*ActionTimelineItemFeed) Name

func (f *ActionTimelineItemFeed) Name() string

Name is the name of the feed

func (*ActionTimelineItemFeed) Order

func (f *ActionTimelineItemFeed) Order() string

Order returns the ordering when retrieving an export

func (*ActionTimelineItemFeed) PrimaryKey

func (f *ActionTimelineItemFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*ActionTimelineItemFeed) RowsModel

func (f *ActionTimelineItemFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type Asset

type Asset struct {
	ID         string    `json:"id" csv:"asset_id" gorm:"primarykey;column:asset_id;size:36"`
	Code       string    `json:"code" csv:"code"`
	TypeID     string    `json:"type_id" csv:"type_id"`
	TypeName   string    `json:"type_name" csv:"type_name"`
	Fields     string    `json:"fields" csv:"fields"`
	CreatedAt  time.Time `json:"created_at" csv:"created_at"`
	ModifiedAt time.Time `json:"modified_at" csv:"modified_at" gorm:"index:idx_ast_modified_at,sort:desc"`
	SiteID     string    `json:"site_id" csv:"site_id" gorm:"size:41"`
	State      string    `json:"state" csv:"state"`
}

Asset represents a row from the assets feed

type AssetFeed

type AssetFeed struct {
	Limit       int
	Incremental bool
}

AssetFeed is a representation of the assets feed

func (*AssetFeed) Columns

func (f *AssetFeed) Columns() []string

Columns returns the columns of the row

func (*AssetFeed) CreateSchema

func (f *AssetFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*AssetFeed) Export

func (f *AssetFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*AssetFeed) HasRemainingInformation

func (f *AssetFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*AssetFeed) Model

func (f *AssetFeed) Model() interface{}

Model returns the model of the feed row

func (*AssetFeed) Name

func (f *AssetFeed) Name() string

Name is the name of the feed

func (*AssetFeed) Order

func (f *AssetFeed) Order() string

Order returns the ordering when retrieving an export

func (*AssetFeed) PrimaryKey

func (f *AssetFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*AssetFeed) RowsModel

func (f *AssetFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type CSVExporter

type CSVExporter struct {
	*SQLExporter
	ExportPath     string
	MaxRowsPerFile int
	Logger         *zap.SugaredLogger
	// contains filtered or unexported fields
}

CSVExporter is an interface to export data feeds to CSV files

func NewCSVExporter

func NewCSVExporter(exportPath, exportMediaPath string, maxRowsPerFile int) (*CSVExporter, error)

NewCSVExporter creates a new instance of CSVExporter

func (*CSVExporter) CreateSchema

func (e *CSVExporter) CreateSchema(feed Feed, rows interface{}) error

CreateSchema generated schema for a feed in csv format

func (*CSVExporter) FinaliseExport

func (e *CSVExporter) FinaliseExport(feed Feed, rows interface{}) error

FinaliseExport closes out an export

func (*CSVExporter) GetDuration

func (e *CSVExporter) GetDuration() time.Duration

GetDuration will return the duration for exporting a batch

type DBConnection

type DBConnection struct {
	// contains filtered or unexported fields
}

DBConnection db connection

type ExportStatus

type ExportStatus struct {
	// contains filtered or unexported fields
}

func GetExporterStatus

func GetExporterStatus() *ExportStatus

GetExporterStatus will return a singleton instance of the ExporterStatus

func (*ExportStatus) FinishFeedExport

func (e *ExportStatus) FinishFeedExport(feedName string, err error)

func (*ExportStatus) GetExportCompleted

func (e *ExportStatus) GetExportCompleted() bool

func (*ExportStatus) GetExportStarted

func (e *ExportStatus) GetExportStarted() bool

func (*ExportStatus) IncrementStatus

func (e *ExportStatus) IncrementStatus(feedName string, counter int64, durationMs int64)

func (*ExportStatus) MarkExportCompleted

func (e *ExportStatus) MarkExportCompleted()

func (*ExportStatus) PurgeFinished

func (e *ExportStatus) PurgeFinished()

func (*ExportStatus) ReadCounter

func (e *ExportStatus) ReadCounter(feedName string) int64

func (*ExportStatus) ReadStatus

func (e *ExportStatus) ReadStatus() map[string]*ExportStatusItem

func (*ExportStatus) Reset

func (e *ExportStatus) Reset()

func (*ExportStatus) StartFeedExport

func (e *ExportStatus) StartFeedExport(feedName string, decremental bool)

func (*ExportStatus) UpdateStage

func (e *ExportStatus) UpdateStage(feedName string, stage ExportStatusItemStage, counterDecremental bool)

func (*ExportStatus) UpdateStatus

func (e *ExportStatus) UpdateStatus(feedName string, counter int64, durationMs int64)

type ExportStatusItem

type ExportStatusItem struct {
	Name               string
	Stage              ExportStatusItemStage
	Started            bool
	Finished           bool
	HasError           bool
	Counter            int64
	CounterDecremental bool
	StatusMessage      string
	DurationMs         int64
}

type ExportStatusItemStage

type ExportStatusItemStage string
const StageApi ExportStatusItemStage = "API_DOWNLOAD"
const StageCsv ExportStatusItemStage = "CSV_EXPORT"

type Exporter

type Exporter interface {
	InitFeed(feed Feed, opts *InitFeedOptions) error
	CreateSchema(feed Feed, rows interface{}) error

	WriteRows(feed Feed, rows interface{}) error
	UpdateRows(feed Feed, primaryKeys []string, element map[string]interface{}) (int64, error)

	FinaliseExport(feed Feed, rows interface{}) error
	LastModifiedAt(feed Feed, modifiedAfter time.Time, orgID string) (time.Time, error)
	LastRecord(feed Feed, modifiedAfter time.Time, orgID string, sortColumn string) time.Time
	WriteMedia(auditID string, mediaID string, contentType string, body []byte) error
	DeleteRowsIfExist(feed Feed, query string, args ...interface{}) error
	GetDuration() time.Duration

	SupportsUpsert() bool
	ParameterLimit() int
}

Exporter is an interface to a Feed exporter. It provides methods to write rows out to an implemented format

type ExporterFeedCfg

type ExporterFeedCfg struct {
	AccessToken                           string
	ExportTables                          []string
	SheqsyUsername                        string
	SheqsyCompanyID                       string
	ExportInspectionSkipIds               []string
	ExportModifiedAfterTime               time.Time
	ExportTemplateIds                     []string
	ExportInspectionArchived              string
	ExportInspectionCompleted             string
	ExportInspectionIncludedInactiveItems bool
	ExportInspectionWebReportLink         string
	ExportInspectionItemsSkipFields       []string
	ExportIncremental                     bool
	ExportInspectionLimit                 int
	ExportMedia                           bool
	ExportSiteIncludeDeleted              bool
	ExportActionLimit                     int
	ExportSiteIncludeFullHierarchy        bool
	ExportIssueLimit                      int
	ExportAssetLimit                      int
	ExportCourseProgressLimit             int
	ExportScheduleResumeDownload          bool
	MaxConcurrentGoRoutines               int
}

type ExporterFeedClient

type ExporterFeedClient struct {
	// contains filtered or unexported fields
}

func NewExporterApp

func NewExporterApp(scApiClient *httpapi.Client, sheqsyApiClient *httpapi.Client, cfg *ExporterFeedCfg) *ExporterFeedClient

func (*ExporterFeedClient) ExportFeeds

func (e *ExporterFeedClient) ExportFeeds(exporter Exporter, ctx context.Context) error

ExportFeeds fetches all the feeds data from server and stores them in the format provided

func (*ExporterFeedClient) ExportInspectionReports

func (e *ExporterFeedClient) ExportInspectionReports(exporter *ReportExporter, ctx context.Context) error

func (*ExporterFeedClient) ExportSchemas

func (e *ExporterFeedClient) ExportSchemas(exporter Exporter) error

ExportSchemas generates schemas for the data feeds without fetching any data

func (*ExporterFeedClient) GetFeeds

func (e *ExporterFeedClient) GetFeeds() []Feed

GetFeeds returns list of available SafetyCulture feeds

func (*ExporterFeedClient) GetSheqsyFeeds

func (e *ExporterFeedClient) GetSheqsyFeeds() []Feed

GetSheqsyFeeds returns list of all available data feeds for sheqsy

func (*ExporterFeedClient) PrintSchemas

func (e *ExporterFeedClient) PrintSchemas(exporter *SchemaExporter) error

PrintSchemas is used to print the schema of each feed to console output

type Feed

type Feed interface {
	Name() string
	Model() interface{}
	RowsModel() interface{}

	PrimaryKey() []string
	Columns() []string
	Order() string

	CreateSchema(exporter Exporter) error
	Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

	// HasRemainingInformation - true if the feed data source provides remaining number of items
	HasRemainingInformation() bool
}

Feed is an interface to a data feed. It provides methods to export the data to an exporter

type GetFeedParams

type GetFeedParams struct {
	ModifiedAfter   time.Time `url:"modified_after,omitempty"`
	TemplateIDs     []string  `url:"template,omitempty"`
	Archived        string    `url:"archived,omitempty"`
	Completed       string    `url:"completed,omitempty"`
	IncludeInactive bool      `url:"include_inactive,omitempty"`
	Limit           int       `url:"limit,omitempty"`
	WebReportLink   string    `url:"web_report_link,omitempty"`
	StartDate       time.Time `url:"start_date,omitempty"`
	EndDate         time.Time `url:"end_date,omitempty"`

	// Applicable only for sites
	IncludeDeleted    bool  `url:"include_deleted,omitempty"`
	ShowOnlyLeafNodes *bool `url:"show_only_leaf_nodes,omitempty"`

	// Applicable only for course progress
	Offset           int    `url:"offset,omitempty"`
	CompletionStatus string `url:"completion_status,omitempty"`
}

GetFeedParams is a list of all parameters we can set when fetching a feed

type GetFeedRequest

type GetFeedRequest struct {
	URL        string
	InitialURL string
	Params     GetFeedParams
}

GetFeedRequest has all the data needed to make a request to get a feed

type GetFeedResponse

type GetFeedResponse struct {
	Metadata PageFeedMetadata `json:"metadata"`

	Data json.RawMessage `json:"data"`
}

GetFeedResponse is a representation of the data returned when fetching a feed

type GetMediaRequest

type GetMediaRequest struct {
	URL     string
	AuditID string
}

GetMediaRequest has all the data needed to make a request to get a media

type GetMediaResponse

type GetMediaResponse struct {
	ContentType string
	Body        []byte
	MediaID     string
}

GetMediaResponse is a representation of the data returned when fetching media

func GetMedia

func GetMedia(ctx context.Context, apiClient *httpapi.Client, request *GetMediaRequest) (*GetMediaResponse, error)

GetMedia fetches the media object from SafetyCulture.

type Group

type Group struct {
	ID             string    `json:"id" csv:"group_id" gorm:"primarykey;column:group_id;size:37"`
	Name           string    `json:"name" csv:"name"`
	OrganisationID string    `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
	ExportedAt     time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
}

Group represents a row from the groups feed

type GroupFeed

type GroupFeed struct{}

GroupFeed is a representation of the groups feed

func (*GroupFeed) Columns

func (f *GroupFeed) Columns() []string

Columns returns the columns of the row

func (*GroupFeed) CreateSchema

func (f *GroupFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*GroupFeed) Export

func (f *GroupFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*GroupFeed) HasRemainingInformation

func (f *GroupFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*GroupFeed) Model

func (f *GroupFeed) Model() interface{}

Model returns the model of the feed row

func (*GroupFeed) Name

func (f *GroupFeed) Name() string

Name is the name of the feed

func (*GroupFeed) Order

func (f *GroupFeed) Order() string

Order returns the ordering when retrieving an export

func (*GroupFeed) PrimaryKey

func (f *GroupFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*GroupFeed) RowsModel

func (f *GroupFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type GroupUser

type GroupUser struct {
	UserID         string    `json:"user_id" csv:"user_id" gorm:"primaryKey;size:37"`
	GroupID        string    `json:"group_id" csv:"group_id" gorm:"primaryKey;size:37"`
	OrganisationID string    `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
	ExportedAt     time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
}

GroupUser represents a row from the group_users feed

type GroupUserFeed

type GroupUserFeed struct{}

GroupUserFeed is a representation of the group_users feed

func (*GroupUserFeed) Columns

func (f *GroupUserFeed) Columns() []string

Columns returns the columns of the row

func (*GroupUserFeed) CreateSchema

func (f *GroupUserFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*GroupUserFeed) Export

func (f *GroupUserFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*GroupUserFeed) HasRemainingInformation

func (f *GroupUserFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*GroupUserFeed) Model

func (f *GroupUserFeed) Model() interface{}

Model returns the model of the feed row

func (*GroupUserFeed) Name

func (f *GroupUserFeed) Name() string

Name is the name of the feed

func (*GroupUserFeed) Order

func (f *GroupUserFeed) Order() string

Order returns the ordering when retrieving an export

func (*GroupUserFeed) PrimaryKey

func (f *GroupUserFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*GroupUserFeed) RowsModel

func (f *GroupUserFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type InitFeedOptions

type InitFeedOptions struct {
	Truncate bool
}

InitFeedOptions contains the options used when initialising a feed

type Inspection

type Inspection struct {
	ID              string     `json:"id" csv:"audit_id" gorm:"primarykey;column:audit_id;size:100"`
	Name            string     `json:"name" csv:"name"`
	Archived        bool       `json:"archived" csv:"archived"`
	OwnerName       string     `json:"owner_name" csv:"owner_name"`
	OwnerID         string     `json:"owner_id" csv:"owner_id" gorm:"size:37"`
	AuthorName      string     `json:"author_name" csv:"author_name"`
	AuthorID        string     `json:"author_id" csv:"author_id" gorm:"size:37"`
	Score           float32    `json:"score" csv:"score"`
	MaxScore        float32    `json:"max_score" csv:"max_score"`
	ScorePercentage float32    `json:"score_percentage" csv:"score_percentage"`
	Duration        int64      `json:"duration" csv:"duration"`
	TemplateID      string     `json:"template_id" csv:"template_id" gorm:"size:100"`
	OrganisationID  string     `json:"organisation_id" csv:"organisation_id" gorm:"index:idx_ins_modified_at;size:37"`
	TemplateName    string     `json:"template_name" csv:"template_name"`
	TemplateAuthor  string     `json:"template_author" csv:"template_author"`
	SiteID          string     `json:"site_id" csv:"site_id" gorm:"size:41"`
	DateStarted     time.Time  `json:"date_started" csv:"date_started"`
	DateCompleted   *time.Time `json:"date_completed" csv:"date_completed"`
	DateModified    time.Time  `json:"date_modified" csv:"date_modified"`
	CreatedAt       time.Time  `json:"created_at" csv:"created_at"`
	ModifiedAt      time.Time  `json:"modified_at" csv:"modified_at" gorm:"index:idx_ins_modified_at,sort:desc"`
	ExportedAt      time.Time  `json:"exported_at" csv:"exported_at" gorm:"index:idx_ins_modified_at;autoUpdateTime"`
	DocumentNo      string     `json:"document_no" csv:"document_no"`
	PreparedBy      string     `json:"prepared_by" csv:"prepared_by"`
	Location        string     `json:"location" csv:"location"`
	ConductedOn     *time.Time `json:"conducted_on" csv:"conducted_on"`
	Personnel       string     `json:"personnel" csv:"personnel"`
	ClientSite      string     `json:"client_site" csv:"client_site"`
	Latitude        *float64   `json:"latitude" csv:"latitude"`
	Longitude       *float64   `json:"longitude" csv:"longitude"`
	WebReportLink   string     `json:"web_report_link" csv:"web_report_link"`
	Deleted         bool       `json:"deleted" csv:"deleted"`
	AssetID         string     `json:"asset_id" csv:"asset_id" gorm:"size:36"`
}

Inspection represents a row from the inspections feed

type InspectionFeed

type InspectionFeed struct {
	SkipIDs       []string
	ModifiedAfter time.Time
	TemplateIDs   []string
	Archived      string
	Completed     string
	Incremental   bool
	Limit         int
	WebReportLink string
}

InspectionFeed is a representation of the inspections feed

func (*InspectionFeed) Columns

func (f *InspectionFeed) Columns() []string

Columns returns the columns of the row

func (*InspectionFeed) CreateSchema

func (f *InspectionFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*InspectionFeed) Export

func (f *InspectionFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*InspectionFeed) HasRemainingInformation

func (f *InspectionFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*InspectionFeed) Model

func (f *InspectionFeed) Model() interface{}

Model returns the model of the feed row

func (*InspectionFeed) Name

func (f *InspectionFeed) Name() string

Name is the name of the feed

func (*InspectionFeed) Order

func (f *InspectionFeed) Order() string

Order returns the ordering when retrieving an export

func (*InspectionFeed) PrimaryKey

func (f *InspectionFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*InspectionFeed) RowsModel

func (f *InspectionFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type InspectionItem

type InspectionItem struct {
	ID                      string    `json:"id" csv:"id" gorm:"primarykey;size:150"`
	ItemID                  string    `json:"item_id" csv:"item_id" gorm:"size:100"`
	AuditID                 string    `json:"audit_id" csv:"audit_id" gorm:"size:100"`
	ItemIndex               int64     `json:"item_index" csv:"item_index"`
	TemplateID              string    `json:"template_id" csv:"template_id" gorm:"size:100"`
	ParentID                string    `json:"parent_id" csv:"parent_id" gorm:"size:100"`
	CreatedAt               time.Time `json:"created_at" csv:"created_at"`
	ModifiedAt              time.Time `json:"modified_at" csv:"modified_at" gorm:"index:idx_ins_itm_modified_at,sort:desc"`
	ExportedAt              time.Time `json:"exported_at" csv:"exported_at" gorm:"index:idx_ins_itm_modified_at;autoUpdateTime"`
	Type                    string    `json:"type" csv:"type" gorm:"size:20"`
	Category                string    `json:"category" csv:"category"`
	CategoryID              string    `json:"category_id" csv:"category_id" gorm:"size:100"`
	OrganisationID          string    `json:"organisation_id" csv:"organisation_id" gorm:"index:idx_ins_itm_modified_at;size:37"`
	ParentIDs               string    `json:"parent_ids" csv:"parent_ids"`
	Label                   string    `json:"label" csv:"label"`
	Response                string    `json:"response" csv:"response"`
	ResponseID              string    `json:"response_id" csv:"response_id" gorm:"size:100"`
	ResponseSetID           string    `json:"response_set_id" csv:"response_set_id" gorm:"size:100"`
	IsFailedResponse        bool      `json:"is_failed_response" csv:"is_failed_response"`
	Comment                 string    `json:"comment" csv:"comment"`
	MediaFiles              string    `json:"media_files" csv:"media_files"`
	MediaIDs                string    `json:"media_ids" csv:"media_ids"`
	MediaHypertextReference string    `json:"media_hypertext_reference" csv:"media_hypertext_reference"`
	Score                   float32   `json:"score" csv:"score"`
	MaxScore                float32   `json:"max_score" csv:"max_score"`
	ScorePercentage         float32   `json:"score_percentage" csv:"score_percentage"`
	CombinedScore           float32   `json:"combined_score" csv:"combined_score"`
	CombinedMaxScore        float32   `json:"combined_max_score" csv:"combined_max_score"`
	CombinedScorePercentage float32   `json:"combined_score_percentage" csv:"combined_score_percentage"`
	Mandatory               bool      `json:"mandatory" csv:"mandatory"`
	Inactive                bool      `json:"inactive" csv:"inactive"`
	LocationLatitude        *float32  `json:"location_latitude" csv:"location_latitude"`
	LocationLongitude       *float32  `json:"location_longitude" csv:"location_longitude"`
	PrimeelementID          string    `json:"primeelement_id" csv:"primeelement_id" gorm:"size:100"`
	PrimeelementIndex       *int64    `json:"primeelement_index" csv:"primeelement_index"`
}

InspectionItem represents a row from the inspection_items feed

type InspectionItemFeed

type InspectionItemFeed struct {
	SkipIDs         []string
	SkipFields      []string
	ModifiedAfter   time.Time
	TemplateIDs     []string
	Archived        string
	Completed       string
	IncludeInactive bool
	Incremental     bool
	ExportMedia     bool
	Limit           int
}

InspectionItemFeed is a representation of the inspection_items feed

func (*InspectionItemFeed) Columns

func (f *InspectionItemFeed) Columns() []string

Columns returns the columns of the row

func (*InspectionItemFeed) CreateSchema

func (f *InspectionItemFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*InspectionItemFeed) Export

func (f *InspectionItemFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*InspectionItemFeed) HasRemainingInformation

func (f *InspectionItemFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*InspectionItemFeed) Model

func (f *InspectionItemFeed) Model() interface{}

Model returns the model of the feed row

func (*InspectionItemFeed) Name

func (f *InspectionItemFeed) Name() string

Name is the name of the feed

func (*InspectionItemFeed) Order

func (f *InspectionItemFeed) Order() string

Order returns the ordering when retrieving an export

func (*InspectionItemFeed) PrimaryKey

func (f *InspectionItemFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*InspectionItemFeed) RowsModel

func (f *InspectionItemFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type Issue

type Issue struct {
	ID              string     `json:"id" csv:"id" gorm:"primarykey;column:id;size:36"`
	Title           string     `json:"title" csv:"title"`
	Description     string     `json:"description" csv:"description"`
	CreatorID       string     `json:"creator_id" csv:"creator_id"`
	CreatorUserName string     `json:"creator_user_name" csv:"creator_user_name"`
	CreatedAt       time.Time  `json:"created_at" csv:"created_at"`
	DueAt           *time.Time `json:"due_at,omitempty" csv:"due_at"`
	Priority        string     `json:"priority" csv:"priority"`
	Status          string     `json:"status" csv:"status"`
	TemplateID      string     `json:"template_id" csv:"template_id"`
	InspectionID    string     `json:"inspection_id" csv:"inspection_id"`
	InspectionName  string     `json:"inspection_name" csv:"inspection_name"`
	SiteID          string     `json:"site_id" csv:"site_id"`
	SiteName        string     `json:"site_name" csv:"site_name"`
	LocationName    string     `json:"location_name" csv:"location_name"`
	CategoryID      string     `json:"category_id" csv:"category_id"`
	CategoryLabel   string     `json:"category_label" csv:"category_label"`
	ModifiedAt      time.Time  `json:"modified_at" csv:"modified_at"`
	CompletedAt     *time.Time `json:"completed_at" csv:"completed_at"`
	AssetID         string     `json:"asset_id" csv:"asset_id" gorm:"size:36"`
	UniqueID        string     `json:"unique_id" csv:"unique_id"`
}

Issue represents a row from the issues feed

type IssueAssignee

type IssueAssignee struct {
	ID             string    `json:"id" csv:"id" gorm:"primarykey;column:id;size:375"`
	IssueID        string    `json:"issue_id" csv:"issue_id" gorm:"index:idx_issue_asg_issue_id;column:issue_id;size:36"`
	AssigneeID     string    `json:"assignee_id" csv:"assignee_id" gorm:"size:256"`
	Name           string    `json:"name" csv:"name"`
	OrganisationID string    `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
	ModifiedAt     time.Time `json:"modified_at" csv:"modified_at" gorm:"index:idx_issue_asg_modified_at,sort:desc;column:modified_at"`
	Type           string    `json:"type" csv:"type"`
}

type IssueAssigneeFeed

type IssueAssigneeFeed struct {
	Incremental bool
	Limit       int
}

func (*IssueAssigneeFeed) Columns

func (f *IssueAssigneeFeed) Columns() []string

func (*IssueAssigneeFeed) CreateSchema

func (f *IssueAssigneeFeed) CreateSchema(exporter Exporter) error

func (*IssueAssigneeFeed) Export

func (f *IssueAssigneeFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*IssueAssigneeFeed) HasRemainingInformation

func (f *IssueAssigneeFeed) HasRemainingInformation() bool

func (*IssueAssigneeFeed) Model

func (f *IssueAssigneeFeed) Model() interface{}

func (*IssueAssigneeFeed) Name

func (f *IssueAssigneeFeed) Name() string

func (*IssueAssigneeFeed) Order

func (f *IssueAssigneeFeed) Order() string

func (*IssueAssigneeFeed) PrimaryKey

func (f *IssueAssigneeFeed) PrimaryKey() []string

func (*IssueAssigneeFeed) RowsModel

func (f *IssueAssigneeFeed) RowsModel() interface{}

type IssueFeed

type IssueFeed struct {
	Limit       int
	Incremental bool
}

IssueFeed is a representation of the issues feed

func (*IssueFeed) Columns

func (f *IssueFeed) Columns() []string

Columns returns the columns of the row

func (*IssueFeed) CreateSchema

func (f *IssueFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*IssueFeed) Export

func (f *IssueFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*IssueFeed) HasRemainingInformation

func (f *IssueFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*IssueFeed) Model

func (f *IssueFeed) Model() interface{}

Model returns the model of the feed row

func (*IssueFeed) Name

func (f *IssueFeed) Name() string

Name returns the name of the feed

func (*IssueFeed) Order

func (f *IssueFeed) Order() string

Order returns the ordering when retrieving an export

func (*IssueFeed) PrimaryKey

func (f *IssueFeed) PrimaryKey() []string

PrimaryKey return the primary key

func (*IssueFeed) RowsModel

func (f *IssueFeed) RowsModel() interface{}

RowsModel returns the model of the feed rows

type IssueTimelineItem

type IssueTimelineItem struct {
	ID              string    `json:"id" csv:"item_id" gorm:"primarykey;column:item_id;size:36"`
	TaskID          string    `json:"task_id" csv:"task_id"`
	OrganisationID  string    `json:"organisation_id" csv:"organisation_id"`
	TaskCreatorID   string    `json:"task_creator_id" csv:"task_creator_id"`
	TaskCreatorName string    `json:"task_creator_name" csv:"task_creator_name"`
	Timestamp       time.Time `json:"timestamp" csv:"timestamp" gorm:"index:idx_iss_tim_timestamp,sort:desc"`
	CreatorID       string    `json:"creator_id" csv:"creator_id"`
	CreatorName     string    `json:"creator_name" csv:"creator_name"`
	ItemType        string    `json:"item_type" csv:"item_type"`
	ItemData        string    `json:"item_data" csv:"item_data"`
}

IssueTimelineItem represents a row from the issue timeline items feed

type IssueTimelineItemFeed

type IssueTimelineItemFeed struct {
	Limit       int
	Incremental bool
}

IssueTimelineItemFeed is a representation of the issue timeline items feed

func (*IssueTimelineItemFeed) Columns

func (f *IssueTimelineItemFeed) Columns() []string

Columns returns the columns of the row

func (*IssueTimelineItemFeed) CreateSchema

func (f *IssueTimelineItemFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*IssueTimelineItemFeed) Export

func (f *IssueTimelineItemFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*IssueTimelineItemFeed) HasRemainingInformation

func (f *IssueTimelineItemFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*IssueTimelineItemFeed) Model

func (f *IssueTimelineItemFeed) Model() interface{}

Model returns the model of the feed row

func (*IssueTimelineItemFeed) Name

func (f *IssueTimelineItemFeed) Name() string

Name is the name of the feed

func (*IssueTimelineItemFeed) Order

func (f *IssueTimelineItemFeed) Order() string

Order returns the ordering when retrieving an export

func (*IssueTimelineItemFeed) PrimaryKey

func (f *IssueTimelineItemFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*IssueTimelineItemFeed) RowsModel

func (f *IssueTimelineItemFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type PageFeedMetadata

type PageFeedMetadata struct {
	NextPage         string `json:"next_page"`
	RemainingRecords int64  `json:"remaining_records"`
}

PageFeedMetadata is a representation of the metadata returned when fetching a feed

type ReportExporter

type ReportExporter struct {
	*SQLExporter
	Logger       *zap.SugaredLogger
	ExportPath   string
	PreferenceID string
	Filename     string
	Format       []string
	Mu           sync.Mutex
	RetryTimeout int
}

ReportExporter is an interface to export data feeds to CSV files

func (*ReportExporter) GetDuration

func (e *ReportExporter) GetDuration() time.Duration

GetDuration will return the duration for exporting a batch

func (*ReportExporter) SaveReports

func (e *ReportExporter) SaveReports(ctx context.Context, apiClient *httpapi.Client, feed *InspectionFeed) error

SaveReports downloads and stores inspection reports on disk

type SQLExporter

type SQLExporter struct {
	DB              *gorm.DB
	Logger          *zap.SugaredLogger
	AutoMigrate     bool
	ExportMediaPath string
	// contains filtered or unexported fields
}

SQLExporter is an interface to export data feeds to SQL databases

func NewSQLExporter

func NewSQLExporter(dialect, connectionString string, autoMigrate bool, exportMediaPath string) (*SQLExporter, error)

NewSQLExporter creates a new instance of the SQLExporter

func NewSQLiteExporter

func NewSQLiteExporter(exportPath string, exportMediaPath string) (*SQLExporter, error)

NewSQLiteExporter creates a new instance of SQLExporter for SQLITE

func (*SQLExporter) CreateSchema

func (e *SQLExporter) CreateSchema(feed Feed, _ interface{}) error

CreateSchema creates the schema on the DB for the supplied feed

func (*SQLExporter) DeleteRowsIfExist

func (e *SQLExporter) DeleteRowsIfExist(feed Feed, query string, args ...interface{}) error

DeleteRowsIfExist will delete the rows if already exist

func (*SQLExporter) FinaliseExport

func (e *SQLExporter) FinaliseExport(Feed, interface{}) error

FinaliseExport closes out an export

func (*SQLExporter) GetDuration

func (e *SQLExporter) GetDuration() time.Duration

GetDuration will return the duration for exporting a batch

func (*SQLExporter) InitFeed

func (e *SQLExporter) InitFeed(feed Feed, opts *InitFeedOptions) error

InitFeed initialises any tables required to export

func (*SQLExporter) LastModifiedAt

func (e *SQLExporter) LastModifiedAt(feed Feed, modifiedAfter time.Time, orgID string) (time.Time, error)

LastModifiedAt returns the latest stored modified at date for the feed

func (*SQLExporter) LastRecord

func (e *SQLExporter) LastRecord(feed Feed, modifiedAfter time.Time, orgID string, sortColumn string) time.Time

LastRecord returns the latest stored record the feed

func (*SQLExporter) ParameterLimit

func (e *SQLExporter) ParameterLimit() int

ParameterLimit returns the number of parameters supported by the target DB

func (*SQLExporter) SupportsUpsert

func (e *SQLExporter) SupportsUpsert() bool

SupportsUpsert returns a bool if the exporter supports upserts

func (*SQLExporter) UpdateRows

func (e *SQLExporter) UpdateRows(feed Feed, primaryKeys []string, element map[string]interface{}) (int64, error)

UpdateRows batch updates. Returns number of rows updated or error. Works with single PKey, not with composed PKeys

func (*SQLExporter) WriteMedia

func (e *SQLExporter) WriteMedia(auditID, mediaID, contentType string, body []byte) error

WriteMedia writes the media to a file

func (*SQLExporter) WriteRows

func (e *SQLExporter) WriteRows(feed Feed, rows interface{}) error

WriteRows writes out the rows to the DB

type SafetyCultureFeedExporter

type SafetyCultureFeedExporter interface {
	// ExportSchemas will generate the schema for SafetyCulture feeds, without downloading data
	ExportSchemas(exporter Exporter) error
	// ExportFeeds will export SafetyCulture feeds and Sheqsy feeds
	ExportFeeds(exporter Exporter) error
	// PrintSchemas is used to print the schema of each feed to console output
	PrintSchemas(exporter *SchemaExporter) error
	// ExportInspectionReports download all the reports for inspections and stores them on disk
	ExportInspectionReports(exporter *ReportExporter) error
}

SafetyCultureFeedExporter defines the basic action in regard to the exporter

type Schedule

type Schedule struct {
	ID              string     `json:"id" csv:"schedule_id" gorm:"primarykey;column:schedule_id;size:45"`
	Description     string     `json:"description" csv:"description"`
	Recurrence      string     `json:"recurrence" csv:"recurrence" gorm:"size:100"`
	Duration        string     `json:"duration" csv:"duration" gorm:"size:50"`
	ModifiedAt      time.Time  `json:"modified_at" csv:"modified_at"`
	ExportedAt      time.Time  `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
	FromDate        time.Time  `json:"from_date" csv:"from_date"`
	ToDate          *time.Time `json:"to_date" csv:"to_date"`
	StartTimeHour   int        `json:"start_time_hour" csv:"start_time_hour"`
	StartTimeMinute int        `json:"start_time_minute" csv:"start_time_minute"`
	AllMustComplete bool       `json:"all_must_complete" csv:"all_must_complete"`
	Status          string     `json:"status" csv:"status" gorm:"size:10"`
	OrganisationID  string     `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
	Timezone        string     `json:"timezone" csv:"timezone"`
	CanLateSubmit   bool       `json:"can_late_submit" csv:"can_late_submit"`
	SiteID          string     `json:"site_id" csv:"site_id" gorm:"size:41"`
	TemplateID      string     `json:"template_id" csv:"template_id" gorm:"size:100"`
	CreatorUserID   string     `json:"creator_user_id" csv:"creator_user_id" gorm:"size:37"`
	AssetID         string     `json:"asset_id" csv:"asset_id" gorm:"size:37"`
}

Schedule represents a row from the schedules feed

type ScheduleAssignee

type ScheduleAssignee struct {
	ID             string    `json:"id" csv:"id" gorm:"primarykey;size:100"`
	ScheduleID     string    `json:"schedule_id" csv:"schedule_id" gorm:"size:45"`
	AssigneeID     string    `json:"assignee_id" csv:"assignee_id" gorm:"size:37"`
	OrganisationID string    `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
	Type           string    `json:"type" csv:"type" gorm:"size:10"`
	Name           string    `json:"name" csv:"name"`
	ExportedAt     time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
}

ScheduleAssignee represents a row from the schedule_assignees feed

type ScheduleAssigneeFeed

type ScheduleAssigneeFeed struct {
	TemplateIDs []string
}

ScheduleAssigneeFeed is a representation of the schedule_assignees feed

func (*ScheduleAssigneeFeed) Columns

func (f *ScheduleAssigneeFeed) Columns() []string

Columns returns the columns of the row

func (*ScheduleAssigneeFeed) CreateSchema

func (f *ScheduleAssigneeFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*ScheduleAssigneeFeed) Export

func (f *ScheduleAssigneeFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*ScheduleAssigneeFeed) HasRemainingInformation

func (f *ScheduleAssigneeFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*ScheduleAssigneeFeed) Model

func (f *ScheduleAssigneeFeed) Model() interface{}

Model returns the model of the feed row

func (*ScheduleAssigneeFeed) Name

func (f *ScheduleAssigneeFeed) Name() string

Name is the name of the feed

func (*ScheduleAssigneeFeed) Order

func (f *ScheduleAssigneeFeed) Order() string

Order returns the ordering when retrieving an export

func (*ScheduleAssigneeFeed) PrimaryKey

func (f *ScheduleAssigneeFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*ScheduleAssigneeFeed) RowsModel

func (f *ScheduleAssigneeFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type ScheduleFeed

type ScheduleFeed struct {
	TemplateIDs []string
}

ScheduleFeed is a representation of the schedules feed

func (*ScheduleFeed) Columns

func (f *ScheduleFeed) Columns() []string

Columns returns the columns of the row

func (*ScheduleFeed) CreateSchema

func (f *ScheduleFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*ScheduleFeed) Export

func (f *ScheduleFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*ScheduleFeed) HasRemainingInformation

func (f *ScheduleFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*ScheduleFeed) Model

func (f *ScheduleFeed) Model() interface{}

Model returns the model of the feed row

func (*ScheduleFeed) Name

func (f *ScheduleFeed) Name() string

Name is the name of the feed

func (*ScheduleFeed) Order

func (f *ScheduleFeed) Order() string

Order returns the ordering when retrieving an export

func (*ScheduleFeed) PrimaryKey

func (f *ScheduleFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*ScheduleFeed) RowsModel

func (f *ScheduleFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type ScheduleOccurrence

type ScheduleOccurrence struct {
	ID               string     `json:"id" csv:"id" gorm:"primarykey;size:128"`
	ScheduleID       string     `json:"schedule_id" csv:"schedule_id" gorm:"size:45"`
	OccurrenceID     string     `json:"occurrence_id" csv:"occurrence_id" gorm:"size:30"`
	TemplateID       string     `json:"template_id" csv:"template_id" gorm:"size:100"`
	OrganisationID   string     `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
	StartTime        *time.Time `json:"start_time" csv:"start_time"`
	DueTime          *time.Time `json:"due_time" csv:"due_time"`
	MissTime         *time.Time `json:"miss_time" csv:"miss_time"`
	OccurrenceStatus string     `json:"occurrence_status" csv:"occurrence_status" gorm:"size:20"`
	AuditID          *string    `json:"audit_id" csv:"audit_id" gorm:"size:100"`
	CompletedAt      *time.Time `json:"completed_at" csv:"completed_at"`
	ExportedAt       time.Time  `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
	UserID           string     `json:"user_id" csv:"user_id" gorm:"size:37"`
	AssigneeStatus   string     `json:"assignee_status" csv:"assignee_status" gorm:"size:20"`
	Note             string     `json:"note" csv:"note" gorm:"size:255"`
}

ScheduleOccurrence represents a row from the schedule_occurrences feed

type ScheduleOccurrenceFeed

type ScheduleOccurrenceFeed struct {
	TemplateIDs    []string
	StartDate      time.Time
	ResumeDownload bool // EXPERIMENTAL: we don't have modified_at from the backend. We will use start_time
}

ScheduleOccurrenceFeed is a representation of the schedule_occurrences feed

func (*ScheduleOccurrenceFeed) Columns

func (f *ScheduleOccurrenceFeed) Columns() []string

Columns returns the columns of the row

func (*ScheduleOccurrenceFeed) CreateSchema

func (f *ScheduleOccurrenceFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*ScheduleOccurrenceFeed) Export

func (f *ScheduleOccurrenceFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*ScheduleOccurrenceFeed) HasRemainingInformation

func (f *ScheduleOccurrenceFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*ScheduleOccurrenceFeed) Model

func (f *ScheduleOccurrenceFeed) Model() interface{}

Model returns the model of the feed row

func (*ScheduleOccurrenceFeed) Name

func (f *ScheduleOccurrenceFeed) Name() string

Name is the name of the feed

func (*ScheduleOccurrenceFeed) Order

func (f *ScheduleOccurrenceFeed) Order() string

Order returns the ordering when retrieving an export

func (*ScheduleOccurrenceFeed) PrimaryKey

func (f *ScheduleOccurrenceFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*ScheduleOccurrenceFeed) RowsModel

func (f *ScheduleOccurrenceFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type SchemaExporter

type SchemaExporter struct {
	*SQLExporter
	Logger *zap.SugaredLogger
	Output io.Writer
}

SchemaExporter is an interface to export data feeds to CSV files

func NewSchemaExporter

func NewSchemaExporter(output io.Writer) (*SchemaExporter, error)

NewSchemaExporter creates a new instance of SchemaExporter

func (*SchemaExporter) GetDuration

func (e *SchemaExporter) GetDuration() time.Duration

GetDuration will return the duration for exporting a batch

func (*SchemaExporter) WriteSchema

func (e *SchemaExporter) WriteSchema(feed Feed) error

WriteSchema writes schema of a feed to output in tabular format

type SheqsyActivity

type SheqsyActivity struct {
	ActivityUID             string    `json:"activityUId" csv:"activity_uid" gorm:"primarykey;column:activity_uid;size:36"`
	ActivityID              int       `json:"activityId" csv:"activity_id" gorm:"column:activity_id"`
	ExternalID              *string   `json:"externalId" csv:"external_id" gorm:"column:external_id"`
	Email                   string    `json:"email" csv:"email" gorm:"column:email"`
	PhoneNumber             string    `json:"phoneNumber" csv:"phone_number" gorm:"column:phone_number"`
	ActivityName            string    `json:"activityName" csv:"activity_name" gorm:"column:activity_name"`
	StartDateTimeUTC        time.Time `json:"startDateTimeUTC" csv:"start_date_time_utc" gorm:"column:start_date_time_utc"`
	FinishDateTimeUTC       time.Time `json:"finishDateTimeUTC" csv:"finish_date_time_utc" gorm:"column:finish_date_time_utc"`
	ActivityType            string    `json:"activityType" csv:"activity_type" gorm:"column:activity_type"`
	EmployeeName            string    `json:"employeeName" csv:"employee_name" gorm:"column:employee_name"`
	EmployeeSurname         string    `json:"employeeSurname" csv:"employee_surname" gorm:"column:employee_surname"`
	StartLatitude           float64   `json:"startLatitude" csv:"start_latitude" gorm:"column:start_latitude"`
	StartLongitude          float64   `json:"startLongitude" csv:"start_longitude" gorm:"column:start_longitude"`
	StartAddress            string    `json:"startAddress" csv:"start_address" gorm:"column:start_address"`
	FinishLatitude          float64   `json:"finishLatitude" csv:"finish_latitude" gorm:"column:finish_latitude"`
	FinishLongitude         float64   `json:"finishLongitude" csv:"finish_longitude" gorm:"column:finish_longitude"`
	FinishAddress           string    `json:"finishAddress" csv:"finish_address" gorm:"column:finish_address"`
	TimeSpentSec            int       `json:"timeSpentSec" csv:"time_spent_sec" gorm:"column:time_spent_sec"`
	Version                 int       `json:"version" csv:"version" gorm:"column:version"`
	TimeEnrouteSec          int       `json:"timeEnrouteSec" csv:"time_enroute_sec" gorm:"column:time_enroute_sec"`
	DistanceTravelledMeters int       `json:"distanceTravelledMeters" csv:"distance_travelled_meters" gorm:"column:distance_travelled_meters"`
	ShiftID                 *int      `json:"shiftId" csv:"shift_id" gorm:"column:shift_id"`
	Departments             string    `json:"departments" csv:"departments" gorm:"type:string;column:departments"`
	ExportedAt              time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
}

SheqsyActivity represents a user in sheqsy

type SheqsyActivityFeed

type SheqsyActivityFeed struct{}

SheqsyActivityFeed is a representation of the users feed

func (*SheqsyActivityFeed) Columns

func (f *SheqsyActivityFeed) Columns() []string

Columns returns the columns of the row

func (*SheqsyActivityFeed) CreateSchema

func (f *SheqsyActivityFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*SheqsyActivityFeed) Export

func (f *SheqsyActivityFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, companyID string) error

Export exports the feed to the supplied exporter

func (*SheqsyActivityFeed) HasRemainingInformation

func (f *SheqsyActivityFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*SheqsyActivityFeed) Model

func (f *SheqsyActivityFeed) Model() interface{}

Model returns the model of the feed row

func (*SheqsyActivityFeed) Name

func (f *SheqsyActivityFeed) Name() string

Name is the name of the feed

func (*SheqsyActivityFeed) Order

func (f *SheqsyActivityFeed) Order() string

Order returns the ordering when retrieving an export

func (*SheqsyActivityFeed) PrimaryKey

func (f *SheqsyActivityFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*SheqsyActivityFeed) RowsModel

func (f *SheqsyActivityFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type SheqsyDepartment

type SheqsyDepartment struct {
	DepartmentUID string    `json:"departmentUId" csv:"department_uid" gorm:"primarykey;column:department_uid;size:36"`
	DepartmentID  int       `json:"departmentId" csv:"department_id" gorm:"column:department_id"`
	Name          string    `json:"name" csv:"name" gorm:"column:name"`
	ExternalName  string    `json:"external_name" csv:"external_name" gorm:"column:external_name"`
	Number        string    `json:"number" csv:"number" gorm:"column:number"`
	Manager       string    `json:"manager" csv:"manager" gorm:"column:manager"`
	ExportedAt    time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
}

SheqsyDepartment represents a user in sheqsy

type SheqsyDepartmentEmployee

type SheqsyDepartmentEmployee struct {
	EmployeeUID   string    `json:"employeeUId" csv:"employee_uid" gorm:"primaryKey;column:employee_uid;size:36"`
	DepartmentUID string    `json:"departmentUId" csv:"department_uid" gorm:"primaryKey;column:department_uid;size:36"`
	EmployeeID    int       `json:"employeeId" csv:"employee_id" gorm:"column:employee_id"`
	DepartmentID  int       `json:"departmentId" csv:"department_id" gorm:"column:department_id"`
	ExportedAt    time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
}

SheqsyDepartmentEmployee represents a user in sheqsy

type SheqsyDepartmentEmployeeFeed

type SheqsyDepartmentEmployeeFeed struct{}

SheqsyDepartmentEmployeeFeed is a representation of the users feed

func (*SheqsyDepartmentEmployeeFeed) Columns

func (f *SheqsyDepartmentEmployeeFeed) Columns() []string

Columns returns the columns of the row

func (*SheqsyDepartmentEmployeeFeed) CreateSchema

func (f *SheqsyDepartmentEmployeeFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*SheqsyDepartmentEmployeeFeed) Export

func (f *SheqsyDepartmentEmployeeFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, companyID string) error

Export exports the feed to the supplied exporter

func (*SheqsyDepartmentEmployeeFeed) HasRemainingInformation

func (f *SheqsyDepartmentEmployeeFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*SheqsyDepartmentEmployeeFeed) Model

func (f *SheqsyDepartmentEmployeeFeed) Model() interface{}

Model returns the model of the feed row

func (*SheqsyDepartmentEmployeeFeed) Name

Name is the name of the feed

func (*SheqsyDepartmentEmployeeFeed) Order

Order returns the ordering when retrieving an export

func (*SheqsyDepartmentEmployeeFeed) PrimaryKey

func (f *SheqsyDepartmentEmployeeFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*SheqsyDepartmentEmployeeFeed) RowsModel

func (f *SheqsyDepartmentEmployeeFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type SheqsyDepartmentFeed

type SheqsyDepartmentFeed struct{}

SheqsyDepartmentFeed is a representation of the users feed

func (*SheqsyDepartmentFeed) Columns

func (f *SheqsyDepartmentFeed) Columns() []string

Columns returns the columns of the row

func (*SheqsyDepartmentFeed) CreateSchema

func (f *SheqsyDepartmentFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*SheqsyDepartmentFeed) Export

func (f *SheqsyDepartmentFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, companyID string) error

Export exports the feed to the supplied exporter

func (*SheqsyDepartmentFeed) HasRemainingInformation

func (f *SheqsyDepartmentFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*SheqsyDepartmentFeed) Model

func (f *SheqsyDepartmentFeed) Model() interface{}

Model returns the model of the feed row

func (*SheqsyDepartmentFeed) Name

func (f *SheqsyDepartmentFeed) Name() string

Name is the name of the feed

func (*SheqsyDepartmentFeed) Order

func (f *SheqsyDepartmentFeed) Order() string

Order returns the ordering when retrieving an export

func (*SheqsyDepartmentFeed) PrimaryKey

func (f *SheqsyDepartmentFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*SheqsyDepartmentFeed) RowsModel

func (f *SheqsyDepartmentFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type SheqsyEmployee

type SheqsyEmployee struct {
	EmployeeUID             string    `json:"employeeUId" csv:"employee_uid" gorm:"primarykey;column:employee_uid;size:36"`
	EmployeeID              int       `json:"employeeId" csv:"employee_id" gorm:"column:employee_id"`
	ExternalID              *string   `json:"externalId" csv:"external_id" gorm:"column:external_id"`
	FirstName               string    `json:"firstName" csv:"first_name" gorm:"column:first_name"`
	LastName                string    `json:"lastName" csv:"last_name" gorm:"column:last_name"`
	Email                   string    `json:"email" csv:"email" gorm:"column:email"`
	AcceptedActivitiesCount int       `json:"acceptedActivitiesCount" csv:"accepted_activities_count" gorm:"column:accepted_activities_count"`
	PendingActivitiesCount  int       `json:"pendingActivitiesCount" csv:"pending_activities_count" gorm:"column:pending_activities_count"`
	IsInPanic               bool      `json:"isInPanic" csv:"is_in_panic" gorm:"column:is_in_panic"`
	Status                  string    `json:"status" csv:"status" gorm:"column:status"`
	LastActivityDateTimeUTC string    `json:"lastActivityDateTimeUTC" csv:"last_activity_date_time_utc" gorm:"column:last_activity_date_time_utc"`
	Departments             string    `json:"departments" csv:"departments" gorm:"column:departments"`
	ExportedAt              time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
}

SheqsyEmployee represents a user in sheqsy

type SheqsyEmployeeFeed

type SheqsyEmployeeFeed struct{}

SheqsyEmployeeFeed is a representation of the users feed

func (*SheqsyEmployeeFeed) Columns

func (f *SheqsyEmployeeFeed) Columns() []string

Columns returns the columns of the row

func (*SheqsyEmployeeFeed) CreateSchema

func (f *SheqsyEmployeeFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*SheqsyEmployeeFeed) Export

func (f *SheqsyEmployeeFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, companyID string) error

Export exports the feed to the supplied exporter

func (*SheqsyEmployeeFeed) HasRemainingInformation

func (f *SheqsyEmployeeFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*SheqsyEmployeeFeed) Model

func (f *SheqsyEmployeeFeed) Model() interface{}

Model returns the model of the feed row

func (*SheqsyEmployeeFeed) Name

func (f *SheqsyEmployeeFeed) Name() string

Name is the name of the feed

func (*SheqsyEmployeeFeed) Order

func (f *SheqsyEmployeeFeed) Order() string

Order returns the ordering when retrieving an export

func (*SheqsyEmployeeFeed) PrimaryKey

func (f *SheqsyEmployeeFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*SheqsyEmployeeFeed) RowsModel

func (f *SheqsyEmployeeFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type SheqsyShift

type SheqsyShift struct {
	ShiftID               int       `json:"shiftId" csv:"shift_id" gorm:"primarykey;column:shift_id;"`
	EmployeeName          string    `json:"employeeName" csv:"employee_name" gorm:"column:employee_name"`
	EmployeeSurname       string    `json:"employeeSurname" csv:"employee_surname" gorm:"column:employee_surname"`
	Email                 string    `json:"email" csv:"email" gorm:"column:email"`
	PhoneNumber           string    `json:"phoneNumber" csv:"phone_number" gorm:"column:phone_number"`
	StartDateTimeUTC      time.Time `json:"startDateTimeUTC" csv:"start_date_time_utc" gorm:"column:start_date_time_utc"`
	FinishDateTimeUTC     time.Time `json:"finishDateTimeUTC" csv:"finish_date_time_utc" gorm:"column:finish_date_time_utc"`
	LastReportedAddress   string    `json:"lastReportedAddress" csv:"last_reported_address" gorm:"column:last_reported_address"`
	LastReportedLatitude  float64   `json:"lastReportedLatitude" csv:"last_reported_latitude" gorm:"column:last_reported_latitude"`
	LastReportedLongitude float64   `json:"lastReportedLongitude" csv:"last_reported_longitude" gorm:"column:last_reported_longitude"`
	Version               int       `json:"version" csv:"version" gorm:"column:version"`
	Departments           string    `json:"departments" csv:"departments" gorm:"column:departments"`
}

SheqsyShift represents a user in sheqsy

type SheqsyShiftFeed

type SheqsyShiftFeed struct{}

SheqsyShiftFeed is a representation of the users feed

func (*SheqsyShiftFeed) Columns

func (f *SheqsyShiftFeed) Columns() []string

Columns returns the columns of the row

func (*SheqsyShiftFeed) CreateSchema

func (f *SheqsyShiftFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*SheqsyShiftFeed) Export

func (f *SheqsyShiftFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, companyID string) error

Export exports the feed to the supplied exporter

func (*SheqsyShiftFeed) HasRemainingInformation

func (f *SheqsyShiftFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*SheqsyShiftFeed) Model

func (f *SheqsyShiftFeed) Model() interface{}

Model returns the model of the feed row

func (*SheqsyShiftFeed) Name

func (f *SheqsyShiftFeed) Name() string

Name is the name of the feed

func (*SheqsyShiftFeed) Order

func (f *SheqsyShiftFeed) Order() string

Order returns the ordering when retrieving an export

func (*SheqsyShiftFeed) PrimaryKey

func (f *SheqsyShiftFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*SheqsyShiftFeed) RowsModel

func (f *SheqsyShiftFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type Site

type Site struct {
	ID             string    `json:"id" csv:"site_id" gorm:"primarykey;column:site_id;size:41"`
	Name           string    `json:"name" csv:"name"`
	CreatorID      string    `json:"creator_id" csv:"creator_id" gorm:"size:37"`
	OrganisationID string    `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
	ExportedAt     time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
	Deleted        bool      `json:"deleted" csv:"deleted" gorm:"deleted"`
	SiteUUID       string    `json:"site_uuid" csv:"site_uuid" gorm:"size:36"`
	MetaLabel      string    `json:"meta_label" csv:"meta_label" gorm:"size:36"`
	ParentID       string    `json:"parent_id" csv:"parent_id" gorm:"size:41"`
}

Site represents a row from the sites feed

type SiteFeed

type SiteFeed struct {
	IncludeDeleted       bool
	IncludeFullHierarchy bool
}

SiteFeed is a representation of the sites feed

func (*SiteFeed) Columns

func (f *SiteFeed) Columns() []string

Columns returns the columns of the row

func (*SiteFeed) CreateSchema

func (f *SiteFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*SiteFeed) Export

func (f *SiteFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*SiteFeed) HasRemainingInformation

func (f *SiteFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*SiteFeed) Model

func (f *SiteFeed) Model() interface{}

Model returns the model of the feed row

func (*SiteFeed) Name

func (f *SiteFeed) Name() string

Name is the name of the feed

func (*SiteFeed) Order

func (f *SiteFeed) Order() string

Order returns the ordering when retrieving an export

func (*SiteFeed) PrimaryKey

func (f *SiteFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*SiteFeed) RowsModel

func (f *SiteFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type SiteMember

type SiteMember struct {
	SiteID     string    `json:"site_id" csv:"site_id" gorm:"primarykey;column:site_id;size:41"`
	MemberID   string    `json:"member_id" csv:"member_id" gorm:"primarykey;column:member_id;size:37"`
	ExportedAt time.Time `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
}

SiteMember represents a row from the site members feed

type SiteMemberFeed

type SiteMemberFeed struct {
}

SiteMemberFeed is a representation of the sites feed

func (*SiteMemberFeed) Columns

func (f *SiteMemberFeed) Columns() []string

Columns returns the columns of the row

func (*SiteMemberFeed) CreateSchema

func (f *SiteMemberFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*SiteMemberFeed) Export

func (f *SiteMemberFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*SiteMemberFeed) HasRemainingInformation

func (f *SiteMemberFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*SiteMemberFeed) Model

func (f *SiteMemberFeed) Model() interface{}

Model returns the model of the feed row

func (*SiteMemberFeed) Name

func (f *SiteMemberFeed) Name() string

Name is the name of the feed

func (*SiteMemberFeed) Order

func (f *SiteMemberFeed) Order() string

Order returns the ordering when retrieving an export

func (*SiteMemberFeed) PrimaryKey

func (f *SiteMemberFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*SiteMemberFeed) RowsModel

func (f *SiteMemberFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type Template

type Template struct {
	ID             string    `json:"id" csv:"template_id" gorm:"primarykey;column:template_id;size:100"`
	Archived       bool      `json:"archived" csv:"archived"`
	Name           string    `json:"name" csv:"name"`
	Description    string    `json:"description" csv:"description"`
	OrganisationID string    `json:"organisation_id" csv:"organisation_id" gorm:"index:idx_tml_modified_at;size:37"`
	OwnerName      string    `json:"owner_name" csv:"owner_name"`
	OwnerID        string    `json:"owner_id" csv:"owner_id" gorm:"size:37"`
	AuthorName     string    `json:"author_name" csv:"author_name"`
	AuthorID       string    `json:"author_id" csv:"author_id" gorm:"size:37"`
	CreatedAt      time.Time `json:"created_at" csv:"created_at"`
	ModifiedAt     time.Time `json:"modified_at" csv:"modified_at" gorm:"index:idx_tml_modified_at,sort:desc"`
	ExportedAt     time.Time `json:"exported_at" csv:"exported_at" gorm:"index:idx_tml_modified_at;autoUpdateTime"`
}

Template represents a row from the templates feed

type TemplateFeed

type TemplateFeed struct {
	ModifiedAfter time.Time
	Incremental   bool
}

TemplateFeed is a representation of the templates feed

func (*TemplateFeed) Columns

func (f *TemplateFeed) Columns() []string

Columns returns the columns of the row

func (*TemplateFeed) CreateSchema

func (f *TemplateFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*TemplateFeed) Export

func (f *TemplateFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*TemplateFeed) HasRemainingInformation

func (f *TemplateFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*TemplateFeed) Model

func (f *TemplateFeed) Model() interface{}

Model returns the model of the feed row

func (*TemplateFeed) Name

func (f *TemplateFeed) Name() string

Name is the name of the feed

func (*TemplateFeed) Order

func (f *TemplateFeed) Order() string

Order returns the ordering when retrieving an export

func (*TemplateFeed) PrimaryKey

func (f *TemplateFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*TemplateFeed) RowsModel

func (f *TemplateFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type TemplatePermission

type TemplatePermission struct {
	ID             string `json:"id" csv:"permission_id" gorm:"primarykey;column:permission_id;size:375"`
	TemplateID     string `json:"template_id" csv:"template_id" gorm:"size:100"`
	Permission     string `json:"permission" csv:"permission" gorm:"size:10"`
	AssigneeID     string `json:"assignee_id" csv:"assignee_id" gorm:"size:256"`
	AssigneeType   string `json:"assignee_type" csv:"assignee_type" gorm:"size:10"`
	OrganisationID string `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
}

TemplatePermission represents a row from the template_permissions feed

type TemplatePermissionFeed

type TemplatePermissionFeed struct {
	ModifiedAfter time.Time
	Incremental   bool
}

TemplatePermissionFeed is a representation of the template_permissions feed

func (*TemplatePermissionFeed) Columns

func (f *TemplatePermissionFeed) Columns() []string

Columns returns the columns of the row

func (*TemplatePermissionFeed) CreateSchema

func (f *TemplatePermissionFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*TemplatePermissionFeed) Export

func (f *TemplatePermissionFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*TemplatePermissionFeed) HasRemainingInformation

func (f *TemplatePermissionFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*TemplatePermissionFeed) Model

func (f *TemplatePermissionFeed) Model() interface{}

Model returns the model of the feed row

func (*TemplatePermissionFeed) Name

func (f *TemplatePermissionFeed) Name() string

Name is the name of the feed

func (*TemplatePermissionFeed) Order

func (f *TemplatePermissionFeed) Order() string

Order returns the ordering when retrieving an export

func (*TemplatePermissionFeed) PrimaryKey

func (f *TemplatePermissionFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*TemplatePermissionFeed) RowsModel

func (f *TemplatePermissionFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type TrainingCourseProgress

type TrainingCourseProgress struct {
	OpenedAt         string  `json:"opened_at" csv:"opened_at"`
	CompletedAt      string  `json:"completed_at" csv:"completed_at"`
	TotalLessons     int32   `json:"total_lessons" csv:"total_lessons"`
	CompletedLessons int32   `json:"completed_lessons" csv:"completed_lessons"`
	CourseID         string  `json:"course_id" csv:"course_id" gorm:"primarykey;column:course_id;size:64"`
	CourseExternalID string  `json:"course_external_id" csv:"course_external_id" gorm:"size:256"`
	CourseTitle      string  `json:"course_title" csv:"course_title"`
	UserEmail        string  `json:"user_email" csv:"user_email" gorm:"size:256"`
	UserFirstName    string  `json:"user_first_name" csv:"user_first_name"`
	UserLastName     string  `json:"user_last_name" csv:"user_last_name"`
	UserID           string  `json:"user_id" csv:"user_id" gorm:"primarykey;column:user_id;size:37"`
	UserExternalID   string  `json:"user_external_id" csv:"user_external_id"`
	ProgressPercent  float32 `json:"progress_percent" csv:"progress_percent"`
	Score            int32   `json:"score" csv:"score"`
	DueAt            string  `json:"due_at" csv:"due_at"`
}

TrainingCourseProgress represents a row for the feed

type TrainingCourseProgressFeed

type TrainingCourseProgressFeed struct {
	Incremental      bool
	Limit            int
	CompletionStatus string
}

TrainingCourseProgressFeed is a representation of the feed

func (*TrainingCourseProgressFeed) Columns

func (f *TrainingCourseProgressFeed) Columns() []string

func (*TrainingCourseProgressFeed) CreateSchema

func (f *TrainingCourseProgressFeed) CreateSchema(exporter Exporter) error

func (*TrainingCourseProgressFeed) Export

func (f *TrainingCourseProgressFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

func (*TrainingCourseProgressFeed) HasRemainingInformation

func (f *TrainingCourseProgressFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*TrainingCourseProgressFeed) Model

func (f *TrainingCourseProgressFeed) Model() interface{}

Model returns the model of the feed row

func (*TrainingCourseProgressFeed) Name

Name is the name of the feed

func (*TrainingCourseProgressFeed) Order

Order returns the ordering when retrieving an export

func (*TrainingCourseProgressFeed) PrimaryKey

func (f *TrainingCourseProgressFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*TrainingCourseProgressFeed) RowsModel

func (f *TrainingCourseProgressFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

type User

type User struct {
	ID             string     `json:"id" csv:"user_id" gorm:"primarykey;column:user_id;size:37"`
	OrganisationID string     `json:"organisation_id" csv:"organisation_id" gorm:"size:37"`
	Email          string     `json:"email" csv:"email" gorm:"size:256"`
	Firstname      string     `json:"firstname" csv:"firstname"`
	Lastname       string     `json:"lastname" csv:"lastname"`
	Active         bool       `json:"active" csv:"active"`
	LastSeenAt     *time.Time `json:"last_seen_at" csv:"last_seen_at"`
	ExportedAt     time.Time  `json:"exported_at" csv:"exported_at" gorm:"autoUpdateTime"`
	SeatType       string     `json:"seat_type" csv:"seat_type" gorm:"seat_type"`
}

User represents a row from the users feed

type UserFeed

type UserFeed struct{}

UserFeed is a representation of the users feed

func (*UserFeed) Columns

func (f *UserFeed) Columns() []string

Columns returns the columns of the row

func (*UserFeed) CreateSchema

func (f *UserFeed) CreateSchema(exporter Exporter) error

CreateSchema creates the schema of the feed for the supplied exporter

func (*UserFeed) Export

func (f *UserFeed) Export(ctx context.Context, apiClient *httpapi.Client, exporter Exporter, orgID string) error

Export exports the feed to the supplied exporter

func (*UserFeed) HasRemainingInformation

func (f *UserFeed) HasRemainingInformation() bool

HasRemainingInformation returns true if the feed returns remaining items information

func (*UserFeed) Model

func (f *UserFeed) Model() interface{}

Model returns the model of the feed row

func (*UserFeed) Name

func (f *UserFeed) Name() string

Name is the name of the feed

func (*UserFeed) Order

func (f *UserFeed) Order() string

Order returns the ordering when retrieving an export

func (*UserFeed) PrimaryKey

func (f *UserFeed) PrimaryKey() []string

PrimaryKey returns the primary key(s)

func (*UserFeed) RowsModel

func (f *UserFeed) RowsModel() interface{}

RowsModel returns the model of feed rows

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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