Documentation ¶
Overview ¶
Package config is the package that holds all the configurable structures and functions. Its main purpose is to allow users to load a configuration from a json file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppContext ¶
AppContext is the structure that holds the current context of the app will be passed in the handlers
type Configuration ¶
type Configuration struct { Context *Context `json:"context"` Database *Database `json:"database"` Manager *ManagerConfig `json:"manager"` }
Configuration is the overarching struct for our configuration object
func LoadConfig ¶
func LoadConfig(filename string) (Configuration, error)
LoadConfig is the main way of interacting and creating a configuration. This will create and validate a configuration from a filename.
type DBRequest ¶
type DBRequest struct { Method string Params map[string]interface{} Queries map[string]interface{} Type string Model Fields }
DBRequest is the object given to our drivers, each driver must implement the MakeRequest function. This function will take a DBRequest object as a parameter. This object will hold a summerized version of the Restful call
type Database ¶
type Database struct { Hostname string `json:"hostname"` Port int `json:"port"` User string `json:"user"` Password string `json:"password"` Type string `json:"type"` }
Database configuration
type Driver ¶
type Driver interface { MakeRequest(*DBRequest) (interface{}, error) ConvertToDriverError(error) error }
Driver interface is what all database drivers must implement, it allows the server to interact with the database without actually caring what the database actually is.
type Field ¶
type Field struct { Key string `json:"key"` ValueType interface{} `json:"value_type,omitempty"` Options []string `json:"options,omitempty"` ForeignKey string `json:"foreignkey,omitempty"` }
Field is the encapsulation of each of the fields of a object within a database. Its the Field of a data model.
func (*Field) IsOptionSet ¶
IsOptionSet checks to see if within that field a specific option flag is set.
type Fields ¶
type Fields []*Field
Fields is the array version of Field
func (Fields) Atomic ¶
Atomic will grab all fields of atomic types, meaning - string, int, int64, etc.
func (Fields) ForeignKeys ¶
ForeignKeys will retrieve all the fields that are not atomic types but rather are types that are defined within the model configuration itself.
type ManagerConfig ¶
type ManagerConfig struct { Generics []string `json:"generics,omitempty"` Plugs []*PlugConfig `json:"plugins"` }
ManagerConfig is config object that will hold everything todo with the endpoints itself, including the datamodels, as well as the generic endpoints that will be set. Things like healthcheck and eventually, the login endpoint
type PlugConfig ¶
type PlugConfig struct { PathToCode string `json:"pathtocode,omitempty"` PathToCompiled string `json:"pathtocompiled,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` Path string `json:"path,omitempty"` Model Fields `json:"model,omitempty"` }
PlugConfig encapsulates everything around the plugin object, this will hold data for both the model method, or code method of setting up your endpoint. TODO: Check if this is the best way