Documentation ¶
Index ¶
Constants ¶
const DrexelUName string = "Drexel University"
DrexelUName holds the Drexel University's name
Variables ¶
var ErrReportNotParsed error = errors.New("report has not been parsed")
ErrReportNotParsed is the error returned when a Parser has not been parsed yet
var ErrReportParsed error = errors.New("report already parsed")
ErrReportParsed is the error returned when a Parser has already parsed a report
Functions ¶
This section is empty.
Types ¶
type DrexelParser ¶
type DrexelParser struct {
// contains filtered or unexported fields
}
DrexelParser implements the Parser interface for Drexel University Clery crime logs
func NewDrexelParser ¶
func NewDrexelParser(geoCache *geo.GeoCache, fields []string) *DrexelParser
NewDrexelParser creates a new DrexelParser instance
func (DrexelParser) Count ¶
func (p DrexelParser) Count() (uint, error)
Count returns the number of crimes parsed in the report.
type Parser ¶
type Parser interface { // Parse takes the text fields saved in the implementing struct and // parses them into a slice of Crime structs. // // A Report ID is provided to the Parse method. Which is the ID of the // Report which these crimes belong to. // // Additionally an error is returned, nil on success. Parse(reportID int) ([]models.Crime, error) // Range returns the date range which the report covers crimes for. // Start time, then end time. Along with an error if one occurs, or nil // on success. // // The parse method is expected to be called before Range(). And an // error will be returned if it has not been. Range() (*time.Time, *time.Time, error) // Count returns the number of Crime models parsed from a report. An // error is returned if one occurs. Nil on success. Count() (uint, error) }
Parser provides methods for converting a stream of pdf text fields to Crime structs. This allows multiple different formats of reports to parsed.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader takes in a Pdf file, and extracts crimes from it. Using the appropriate parser, based on the header.
func (Reader) Crimes ¶
Crimes returns the crimes recorded in the specified Clery report. Along with a boolean indicating if the report has been parsed yet