Ad Data is an application that creates a search index of all tables within a database, and allows a user to dump the contents of a table into a CSV-encoded file.
Building: “` bash $ go build -o addata command/command.go “`
Usage: “` bash $ ./addata -c [JSON config file] “`
API creates and managers a pointer to a web.Server, and has methods for the HTTP API so we can easily expose the other required types.
NewAPI returns a pointer to a new API instance, creating all the required types for the API to function.
ReturnTable returns a CSV-encoded download of a table's contents.
Run starts the API instance, which in turn starts the web.Server.
Search searches for a given table name against the Index, and returns a list of string tablenames.
Application represents a collection of the other types within this package. This is the only type that most implementations will have to create, usually via NewApplication.
NewApplication returns a pointer to a new Application. Most implemenations will only need to call this to create all the required other types.
Maintenance creates a loop that refreshs the index on an interval.
Run starts the Application, which then starts all the other required types within.
Configuration maps directly to the passed JSON configuration file keys.
Index stores the internal ferret.InvertedSuffix and required channels for concurrent access.
NewIndex returns a pointer to a new Index.
Query checks a given string against the internal ferret.InvertedSuffix and return a slice of string matches.
RebuildWith rebuilds the Index's internal ferret.InvertedSuffix with the supplied slice of strings.
Run starts the Index running it's required goroutines.
Query gathers the required information to make a query together for ease of communication across channels.
Type Store stores the DSN for the Database access, derived from the Application Configuration.
NewStore returns a pointer to a new Store
GetTableNames returns a list of the string table names, gathered from the database.
ReturnTable returns the rows of a table in a format that's applicable for CSV encoding in the API.