Documentation ¶
Overview ¶
Package database manages storage
Index ¶
- type Contribution
- type Contributions
- type Database
- func (db *Database) Close() error
- func (db *Database) Exec(query string) error
- func (db *Database) Initialize() error
- func (db *Database) InsertContribution(c Contribution) error
- func (db *Database) Query(opts QueryOptions) (QueryResponse, error)
- func (db *Database) UpdateContribution(c Contribution) error
- type QueryOptions
- type QueryResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contribution ¶
type Contribution struct { Ref string `json:"ref"` Name string `json:"name"` ContributionType string `json:"type"` SourceURL string Author string `json:"author"` UploadedOn string ShowcaseEnabled bool Description string `json:"description"` Version string `json:"version"` Title string `json:"title"` Homepage string `json:"homepage"` Legacy bool }
Contribution is an activity or trigger created for Flogo
type Contributions ¶
type Contributions []Contribution
Contributions is a slice of contribution objects
type Database ¶
Database implements methods to perform operations on the database.
func MustOpenSession ¶
MustOpenSession is like OpenSession but panics if the session cannot be created.
func OpenSession ¶
OpenSession creates a new reference to an SQLite database. If the file cannot be found an exception will be returned.
func (*Database) Close ¶
Close closes the database and prevents new queries from starting. Close then waits for all queries that have started processing on the server to finish.
func (*Database) Exec ¶
Exec executes a query without returning any rows. An error is returned only when the database throws an error.
func (*Database) Initialize ¶
Initialize creates the new database structure. This method must be called if you're starting with a brand new database. The sourceurl (github url) is the primary key as there can be only one activity in a location.
func (*Database) InsertContribution ¶
func (db *Database) InsertContribution(c Contribution) error
InsertContribution inserts activities and triggers into the database,
func (*Database) Query ¶
func (db *Database) Query(opts QueryOptions) (QueryResponse, error)
Query run a query on the database and prints the result in a table.
func (*Database) UpdateContribution ¶
func (db *Database) UpdateContribution(c Contribution) error
UpdateContribution updates the data for activities and triggers in the database,
type QueryOptions ¶
type QueryOptions struct { // Writer is where the result is sent to Writer io.Writer // Query is executed on the database Query string // MergeCells enables the merge of cells with identical values MergeCells bool // RowLine enables a line on each row of the table RowLine bool // Caption sets a caption for the table Caption string // Render enables the rendering of the table output Render bool }
QueryOptions represents the options you can have for a query and how the result will be rendered
type QueryResponse ¶
type QueryResponse struct { Rows [][]string ColumnNames []string Table *tablewriter.Table }
QueryResponse represents the response from a query