Documentation ¶
Index ¶
- func HandleError(err error)
- func Hash(s string) uint32
- func Info(w http.ResponseWriter, r *http.Request)
- func Starter(url string) error
- type Config
- func (config *Config) GetCache(query string) (*string, error)
- func (config *Config) GetQuery() func(w http.ResponseWriter, r *http.Request)
- func (config *Config) PerformCachedQuery(query string) (*string, error)
- func (config *Config) PerformQuery(query string) (*string, error)
- func (config *Config) Query() func(w http.ResponseWriter, r *http.Request)
- func (config *Config) SetCache(query string, answer string) error
- func (config *Config) SetupRouter() *mux.Router
- type ErrorJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶
func HandleError(err error)
HandleError simply logs and exits the program if the error exists
Types ¶
type Config ¶
type Config struct { //URL is the url for the dgraph database URL string // DBClient is the database client DBClient *db.ConfigDB // CacheDB is the cache client CacheDB *badger.DB // Lock is a global lock for database operations, just makes it a bit nicer. Lock *sync.Mutex }
Config is the API configuration
func (*Config) GetQuery ¶
func (config *Config) GetQuery() func(w http.ResponseWriter, r *http.Request)
GetQuery performs a read only query without badger
func (*Config) PerformCachedQuery ¶
PerformCachedQuery is the main accessor with cache abilities
func (*Config) PerformQuery ¶
PerformQuery is the main db accessor, without caching abilities.
func (*Config) Query ¶
func (config *Config) Query() func(w http.ResponseWriter, r *http.Request)
Query performs a read only query
func (*Config) SetupRouter ¶
SetupRouter returns a router with all the routes attached
Click to show internal directories.
Click to hide internal directories.