Documentation ¶
Index ¶
Constants ¶
const ( // LogDatabase defines the database name for log entries // via Mongo. LogDatabase = "logs" // LogService defines the collection name for log entries // via Mongo. LogService = "api" )
Variables ¶
This section is empty.
Functions ¶
func GetObjectID ¶ added in v0.2.0
GetObjectID returns the primitive.ObjectID if there is one set, otherwise it returns nil.
Types ¶
type BackLinkCheck ¶ added in v0.0.15
type BackLinkCheck struct { GroupSlug string `json:"group_slug" bson:"group_slug"` LinkID int64 `json:"link_id" bson:"link_id"` URL string `json:"url" bson:"url"` Link string `json:"link" bson:"link"` } //@name BackLinkCheck
BackLinkCheck represents the data sent to the Lambda function for checking if a backlink appears on the page.
type Error ¶
type Error struct { Err *errors.Error `json:"error" bson:"error"` Service string `json:"service" bson:"service"` // Currently running function, for example "scrape" }
Error represents an error that occurred during the processing of a Krang Lambda function.
type Page ¶
type Page struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` ScrapeID *primitive.ObjectID `json:"scrape_id" bson:"scrape_id"` UUID string `json:"uuid,omitempty" bson:"-"` // Used for SQS dedupe. URL string `json:"url" bson:"url"` GroupSlug string `json:"group_slug" bson:"group_slug"` ProjectID int64 `json:"project_id" bson:"project_id"` TaskID int64 `json:"task_id" bson:"task_id"` SearchTerm string `json:"search_term" bson:"search_term"` RelevancyScore int `json:"relevancy_score" bson:"relevancy_score"` SiteScore int `json:"site_score" bson:"site_score"` Scrape Scrape `json:"scrape" bson:"scrape,omitempty"` Status ScrapeStatus `json:"status" bson:"status"` Usage PageUsage `json:"usage" bson:"usage"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` CreatedAt time.Time `json:"created_at" bson:"created_at"` } //@name Page
Page represents an individual task scrape including metadata from the Task.
func (*Page) HasScrape ¶ added in v0.2.0
HasScrape determines if a page has a Scrape ID attached to it.
func (*Page) LogMessage ¶ added in v0.2.0
LogMessage returns a formatted message for processing Lambda functions.
type PageUsage ¶ added in v0.2.7
type PageUsage struct { Ahrefs PageUsageAhrefs `json:"ahrefs" bson:"ahrefs"` } //@name PageUsage
PageUsage represents any costs that have been associated with the page.
type PageUsageAhrefs ¶ added in v0.2.7
type PageUsageAhrefs struct { Rows int `json:"rows_used" bson:"rows"` UnitCostRows int `json:"unit_cost_rows" bson:"unit_cost_rows"` Cached bool `json:"cached" bson:"cached"` Called bool `json:"called" bson:"called"` } //@name PageUsageAhrefs
PageUsageAhrefs represents the total amount of cost a singular call to Ahrefs cost.
type Scrape ¶
type Scrape struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` URL string `json:"-" bson:"url" swagggerignore:"true"` HTTPStatus int `json:"http_status" bson:"http_status"` Content ScrapeContent `json:"content" bson:"content"` Metrics ScrapeMetrics `json:"metrics" bson:"metrics"` Message string `json:"message" bson:"message"` Status ScrapeStatus `json:"status" bson:"status"` Error any `json:"error" bson:"error"` Service string `json:"service" bson:"service"` // Currently running function, for example "scrape"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` CreatedAt time.Time `json:"created_at" bson:"created_at"` } //@name Scrape
Scrape represents an individual scrape of a page and its various metrics.
type ScrapeAhrefs ¶ added in v0.2.7
type ScrapeAhrefs struct { DR float64 `json:"dr" bson:"dr"` // Domain Ranking Rank *float64 `json:"rank" bson:"rank"` // Ahrefs Rank } //@name ScrapeAhrefs
ScrapeAhrefs represents the metrics retrieved from the Ahrefs API including cost, rows and if it was cached.
type ScrapeContent ¶
type ScrapeContent struct { H1 string `json:"h1" bson:"h1"` H2 string `json:"h2" bson:"h2"` Title string `json:"title" bson:"title"` ExternalLinks int `json:"external_links" bson:"external_links"` Keywords []ScrapeKeyword `json:"keywords" bson:"keywords"` } //@name ScrapeContent
ScrapeContent represents the HTML markup of a page including any <body> content that's relevant for scoring.
type ScrapeKeyword ¶ added in v0.0.13
type ScrapeKeyword struct { Term string `json:"term" bson:"term"` Salience float64 `json:"salience" bson:"salience"` } //@name ScrapeKeyword
ScrapeKeyword represents a singular entity extracted from a given piece of text.
type ScrapeMetrics ¶
type ScrapeMetrics struct { Ahrefs ScrapeAhrefs `json:"ahrefs" bson:"ahrefs"` } //@name ScrapeMetrics
ScrapeMetrics represents the scores and metrics retrieved from Ahrefs, Moz and Majestic.
type ScrapeStatus ¶ added in v0.1.3
type ScrapeStatus string
ScrapeStatus status represents the status of a page task.
const ( // ScrapeStatusProcessing is the status that defines // a processing page. ScrapeStatusProcessing ScrapeStatus = "processing" // ScrapeStatusFailed is the status that defines // a failed page task. ScrapeStatusFailed ScrapeStatus = "failed" // ScrapeStatusTimedOut is the status that defines // a timed out page task. ScrapeStatusTimedOut ScrapeStatus = "timed-out" // ScrapeStatusSuccess is the status that defines // a successful page task. ScrapeStatusSuccess ScrapeStatus = "success" )