Documentation ¶
Overview ¶
Package models stores the structs for the objects we have & interacts with mongo
Package models stores the structs for the objects we have
Index ¶
- Constants
- func CreateKbartFile(records []Record, fname string) (int64, error)
- func CreateUnimarcFile(records []Record, fname string) (int64, error)
- func RecordDelete(ID string) error
- func RecordUpsert(record Record) (int, int, error)
- func RecordsCount() int
- func RecordsCountPPNs() int
- func RecordsCountUnimarc() int
- func RecordsUpsert(records []Record) (int, int)
- func TSCountPPNs(tsname string) int
- func TSCountRecords(tsname string) int
- func TSCountRecordsUnimarc(tsname string) int
- func TSCreate(ts TargetService) error
- func TSDelete(tsname string) error
- func TSUpdate(ts TargetService) error
- func UserCreate(username, password string) error
- func UserDelete(ID string) error
- func UserUpdateDateLastSeen(u User) error
- func UsersCount() int
- type Identifier
- type Record
- func RecordGetByID(ID string) (Record, error)
- func RecordUpdate(record Record) (Record, error)
- func RecordsGetByTSName(tsname string, n int) ([]Record, error)
- func RecordsGetNoPPNByTSName(tsname string) ([]Record, error)
- func RecordsGetWithPPNByTSName(tsname string) ([]Record, error)
- func RecordsGetWithUnimarcByTSName(tsname string) ([]Record, error)
- func Search(r *http.Request) ([]Record, string, error)
- type TSCSVConf
- type TSEmbed
- type TargetService
- type User
Constants ¶
const ( IDTypeOnline = iota // Types of Identifiers: mostly online ISBN / ISSN IDTypePrint // Types of Identifiers: mostly print ISBN / ISSN IDTypePPN // Types of Identifiers: unimarc record ID in Sudoc catalog IDTypeSFX // Types of Identifiers: ID in Ex Libris' SFX Open resolver )
Variables ¶
This section is empty.
Functions ¶
func CreateKbartFile ¶
CreateKbartFile creates csv file with KBART fields from records
func CreateUnimarcFile ¶
CreateUnimarcFile creates the file to be exported
func RecordUpsert ¶
RecordUpsert inserts or updates a record in DB
func RecordsCountPPNs ¶
func RecordsCountPPNs() int
RecordsCountPPNs retrieves the number of record that have a PPN Identifier
func RecordsCountUnimarc ¶
func RecordsCountUnimarc() int
RecordsCountUnimarc retrieves the number of record that have a RecordUnimarc field
func RecordsUpsert ¶
RecordsUpsert updates or inserts a number of records in DB
func TSCountPPNs ¶
TSCountPPNs counts how many records for this target service have proper PicaPublication Numbers coming from ABES
func TSCountRecords ¶
TSCountRecords counts the number of records for this target service
func TSCountRecordsUnimarc ¶
TSCountRecordsUnimarc counts how many records for this target service have proper MARC Records
func TSCreate ¶
func TSCreate(ts TargetService) error
TSCreate registers a new target service, aka ebook package in mongo db NOTE: should review the code generally to see when to really use pointers rather than values here : should pbly be a value, since we neither change nor return the struct
func UserUpdateDateLastSeen ¶
UserUpdateDateLastSeen updates a user's record when she logs in
func UsersCount ¶
func UsersCount() int
Types ¶
type Identifier ¶
Identifier embedded in an record
type Record ¶
type Record struct { ID bson.ObjectId `bson:"_id,omitempty"` AccessType string `bson:",omitempty"` Acquired bool `bson:",omitempty"` Active bool CoverageDepth string `bson:",omitempty"` CoverageNotes string `bson:",omitempty"` DateCreated time.Time DateFirstIssueOnline string `bson:",omitempty"` DateLastIssueOnline string `bson:",omitempty"` DateMonographPublishedOnline string `bson:",omitempty"` DateMonographPublishedPrint string `bson:",omitempty"` DateUpdated time.Time `bson:",omitempty"` Deleted bool EmbargoInfo string `bson:",omitempty"` FirstAuthor string `bson:",omitempty"` FirstEditor string `bson:",omitempty"` Identifiers []Identifier `bson:",omitempty"` MonographEdition string `bson:",omitempty"` MonographVolume string `bson:",omitempty"` Notes string `bson:",omitempty"` NumFirstIssueOnline string `bson:",omitempty"` NumFirstVolOnline string `bson:",omitempty"` NumLastIssueOnline string `bson:",omitempty"` NumLastVolOnline string `bson:",omitempty"` ParentPublicationTitleID string `bson:",omitempty"` PrecedingPublicationTitleID string `bson:",omitempty"` PublicationTitle string PublicationType string `bson:",omitempty"` PublisherName string `bson:",omitempty"` RecordMarc21 string `bson:",omitempty"` RecordUnimarc string `bson:",omitempty"` TargetServices []TSEmbed `bson:",omitempty"` // this is the name of the package in SFX, e.g. CAIRN QSJ TitleID string `bson:",omitempty"` TitleURL string `bson:",omitempty"` }
Record stores a full record for a resource
func RecordGetByID ¶
RecordGetByID retrieves a record given its mongodb ID
func RecordUpdate ¶
RecordUpdate saves an updated record struct to DB
func RecordsGetByTSName ¶
RecordsGetByTSName retrieves the records which have a given target service i.e. belong to a given package. n is used to paginate. Use 0 if you want to start at record #1
func RecordsGetNoPPNByTSName ¶
RecordsGetNoPPNByTSName retrieves all records with conditions : no PPN, given TS used to prepare query to sudoc isbn2ppn web service
func RecordsGetWithPPNByTSName ¶
RecordsGetWithPPNByTSName retrieves all records with condition : has PPN, given TS used to prepare query to sudoc get record web service
func RecordsGetWithUnimarcByTSName ¶
RecordsGetWithUnimarcByTSName retrieves all records with condition : has Unimarc Record, given TS
type TSCSVConf ¶
type TSCSVConf struct { Col1 string `bson:",omitempty" tag_col:"0"` Col2 string `bson:",omitempty" tag_col:"1"` Col3 string `bson:",omitempty" tag_col:"2"` Col4 string `bson:",omitempty" tag_col:"3"` Col5 string `bson:",omitempty" tag_col:"4"` Col6 string `bson:",omitempty" tag_col:"5"` Col7 string `bson:",omitempty" tag_col:"6"` Col8 string `bson:",omitempty" tag_col:"7"` Col9 string `bson:",omitempty" tag_col:"8"` Col10 string `bson:",omitempty" tag_col:"9"` }
TSCSVConf indicates the # of fields + column (index) of the various pieces of info in the csv file
type TargetService ¶
type TargetService struct { ID bson.ObjectId `bson:"_id,omitempty"` TSName string `bson:",omitempty" schema:"tsname"` TSDisplayName string `bson:",omitempty" schema:"tsdisplayname"` TSDateCreated time.Time TSDateUpdated time.Time `bson:",omitempty"` TSPublisherLastHarvest time.Time `bson:",omitempty"` TSSFXLastHarvest time.Time `bson:",omitempty"` TSSudocLastHarvest time.Time `bson:",omitempty"` TSActive bool `schema:"tsactive"` TSCsvConf TSCSVConf `bson:",omitempty"` }
TargetService represents an SFX Target Service, i.e. a package with its provider e.g. SPRINGER MATH EBOOKS
func GetTargetService ¶
func GetTargetService(tsname string) (TargetService, error)
GetTargetService retrieves a target service
func GetTargetServicesListing ¶
func GetTargetServicesListing() ([]TargetService, error)
GetTargetServicesListing retrieves the full list of target services
type User ¶
type User struct { ID bson.ObjectId `bson:"_id"` DateCreated time.Time DateLastSeen time.Time `bson:",omitempty"` Username string `bson:"username"` Password string `bson:"password"` }
User contains the info for each user
func UserByUsername ¶
UserByUsername retrieves a user by its username