Documentation ¶
Index ¶
- Variables
- type ConfigDB
- func (config *ConfigDB) CountNodesWithFieldUnsafe(f string) (*int, error)
- func (config *ConfigDB) GetEvent(event Event) (*Event, error)
- func (config *ConfigDB) GetLocationFromKentSlug(slug string) (*Location, error)
- func (config *ConfigDB) GetModuleFromSDSCode(slug string) (*Module, error)
- func (config *ConfigDB) GetOldestScrape() (*Scrape, error)
- func (config *ConfigDB) GetScrape(scrape Scrape) (*Scrape, error)
- func (config *ConfigDB) ReadOnly(q string) ([]byte, error)
- func (config *ConfigDB) RemoveScrape(scrape Scrape) error
- func (config *ConfigDB) Setup() error
- func (config *ConfigDB) UpsertEvent(event Event) (*api.Response, error)
- func (config *ConfigDB) UpsertLocation(loc Location) (*api.Response, error)
- func (config *ConfigDB) UpsertModule(m Module) (*api.Response, error)
- func (config *ConfigDB) UpsertScrape(scrape Scrape) (*api.Response, error)
- type Event
- type Loc
- type Location
- type Module
- type Person
- type Scrape
Constants ¶
This section is empty.
Variables ¶
var Schema = `` /* 1251-byte string literal not displayed */
Schema is the database schema
Functions ¶
This section is empty.
Types ¶
type ConfigDB ¶
type ConfigDB struct {
DBClient *dgo.Dgraph
}
ConfigDB is the configuration for DGraph
func (*ConfigDB) CountNodesWithFieldUnsafe ¶
CountNodesWithFieldUnsafe returns the number of nodes which contain the specified field this is a good indicator of the number of nodes of a certain type this is unsafe, there is no input sanitation and is open to injection attacks
func (*ConfigDB) GetEvent ¶
GetEvent should recieve a dgraph client and an event struct, and return the official event struct from the database, complete with Uid for referencing if no such event exists, then it returns an error
func (*ConfigDB) GetLocationFromKentSlug ¶
GetLocationFromKentSlug returns a matching location from the slug kent uses internally
func (*ConfigDB) GetModuleFromSDSCode ¶
GetModuleFromSDSCode returns a matching module from the slug kent uses internally, or nil if it doesnt exist
func (*ConfigDB) GetOldestScrape ¶
GetOldestScrape retrieves the oldest scrape from the database
func (*ConfigDB) GetScrape ¶
GetScrape should recieve a dgraph client and a scrape struct, and return the official scrape struct from the database, complete with Uid for referencing if no such struct exists, then it returns an error
func (*ConfigDB) ReadOnly ¶
ReadOnly is a read only transaction on the database - this is assumed to be ok
func (*ConfigDB) RemoveScrape ¶
RemoveScrape deletes the specified scrape from the database.
func (*ConfigDB) UpsertEvent ¶
UpsertEvent upserts the event struct into the database
func (*ConfigDB) UpsertLocation ¶
UpsertLocation upserts the location struct into the database
func (*ConfigDB) UpsertModule ¶
UpsertModule upserts the location struct into the database
type Event ¶
type Event struct { UID string `json:"uid,omitempty"` ID string `json:"event.id,omitempty"` Title string `json:"event.title,omitempty"` Description string `json:"event.description,omitempty"` StartDate *time.Time `json:"event.start_date,omitempty"` EndDate *time.Time `json:"event.end_date,omitempty"` Organiser []Person `json:"event.organiser,omitempty"` PartOfModule []Module `json:"event.part_of_module,omitempty"` Location []Location `json:"event.location,omitempty"` DType []string `json:"dgraph.type,omitempty"` }