Documentation
¶
Index ¶
- Constants
- Variables
- type Migrations
- func (m *Migrations) Delete(opts ...QueryOption) string
- func (m *Migrations) GetFilename() string
- func (m *Migrations) GetProject() string
- func (m *Migrations) GetStatementIndex() int64
- func (m *Migrations) GetStatus() string
- func (m *Migrations) Insert(opts ...QueryOption) string
- func (m *Migrations) Select(opts ...QueryOption) string
- func (m *Migrations) SetFilename(val string)
- func (m *Migrations) SetProject(val string)
- func (m *Migrations) SetStatementIndex(val int64)
- func (m *Migrations) SetStatus(val string)
- func (m *Migrations) Update(opts ...QueryOption) string
- type PulseDaily
- func (p *PulseDaily) Delete(opts ...QueryOption) string
- func (p *PulseDaily) GetCount() int64
- func (p *PulseDaily) GetHostname() string
- func (p *PulseDaily) GetStamp() *time.Time
- func (p *PulseDaily) GetUserID() string
- func (p *PulseDaily) Insert(opts ...QueryOption) string
- func (p *PulseDaily) Select(opts ...QueryOption) string
- func (p *PulseDaily) SetCount(val int64)
- func (p *PulseDaily) SetHostname(val string)
- func (p *PulseDaily) SetStamp(stamp time.Time)
- func (p *PulseDaily) SetUserID(val string)
- func (p *PulseDaily) Update(opts ...QueryOption) string
- type PulseHost
- func (p *PulseHost) Delete(opts ...QueryOption) string
- func (p *PulseHost) GetCreatedAt() *time.Time
- func (p *PulseHost) GetHostname() string
- func (p *PulseHost) GetUserID() string
- func (p *PulseHost) Insert(opts ...QueryOption) string
- func (p *PulseHost) Select(opts ...QueryOption) string
- func (p *PulseHost) SetCreatedAt(stamp time.Time)
- func (p *PulseHost) SetHostname(val string)
- func (p *PulseHost) SetUserID(val string)
- func (p *PulseHost) Update(opts ...QueryOption) string
- type PulseHourly
- func (p *PulseHourly) Delete(opts ...QueryOption) string
- func (p *PulseHourly) GetCount() int64
- func (p *PulseHourly) GetHostname() string
- func (p *PulseHourly) GetStamp() *time.Time
- func (p *PulseHourly) GetUserID() string
- func (p *PulseHourly) Insert(opts ...QueryOption) string
- func (p *PulseHourly) Select(opts ...QueryOption) string
- func (p *PulseHourly) SetCount(val int64)
- func (p *PulseHourly) SetHostname(val string)
- func (p *PulseHourly) SetStamp(stamp time.Time)
- func (p *PulseHourly) SetUserID(val string)
- func (p *PulseHourly) Update(opts ...QueryOption) string
- type QueryConfig
- func (q *QueryConfig) Apply(opts ...QueryOption) *QueryConfig
- func (q *QueryConfig) WithColumns(cols []string) QueryOption
- func (q *QueryConfig) WithLimit(start, offset int) QueryOption
- func (q *QueryConfig) WithOrderBy(clause string) QueryOption
- func (q *QueryConfig) WithStatement(stmt string) QueryOption
- func (q *QueryConfig) WithTable(name string) QueryOption
- func (q *QueryConfig) WithWhere(clause string) QueryOption
- type QueryOption
Constants ¶
const MigrationsTable = "`migrations`"
MigrationsTable is the name of the table in the DB.
const PulseDailyTable = "`pulse_daily`"
PulseDailyTable is the name of the table in the DB.
const PulseHostTable = "`pulse_host`"
PulseHostTable is the name of the table in the DB.
const PulseHourlyTable = "`pulse_hourly`"
PulseHourlyTable is the name of the table in the DB.
Variables ¶
var MigrationsFields = []string{"project", "filename", "statement_index", "status"}
MigrationsFields is a list of all columns in the DB table.
var MigrationsPrimaryFields = []string{"project", "filename"}
MigrationsPrimaryFields are the primary key fields in the DB table.
var PulseDailyFields = []string{"user_id", "hostname", "stamp", "count"}
PulseDailyFields is a list of all columns in the DB table.
var PulseDailyPrimaryFields = []string{"user_id", "hostname", "stamp"}
PulseDailyPrimaryFields are the primary key fields in the DB table.
var PulseHostFields = []string{"user_id", "hostname", "created_at"}
PulseHostFields is a list of all columns in the DB table.
var PulseHostPrimaryFields = []string{"user_id", "hostname"}
PulseHostPrimaryFields are the primary key fields in the DB table.
var PulseHourlyFields = []string{"user_id", "hostname", "stamp", "count"}
PulseHourlyFields is a list of all columns in the DB table.
var PulseHourlyPrimaryFields = []string{"user_id", "hostname", "stamp"}
PulseHourlyPrimaryFields are the primary key fields in the DB table.
Functions ¶
This section is empty.
Types ¶
type Migrations ¶
type Migrations struct {
// Project
Project string `db:"project" json:"project"`
// Filename
Filename string `db:"filename" json:"filename"`
// Statement Index
StatementIndex int64 `db:"statement_index" json:"statement_index"`
// Status
Status string `db:"status" json:"status"`
}
Migrations generated for db table `migrations`.
func (*Migrations) Delete ¶
func (m *Migrations) Delete(opts ...QueryOption) string
Delete starts building a DELETE query.
func (*Migrations) GetFilename ¶
func (m *Migrations) GetFilename() string
GetFilename will return the value of Filename.
func (*Migrations) GetProject ¶
func (m *Migrations) GetProject() string
GetProject will return the value of Project.
func (*Migrations) GetStatementIndex ¶
func (m *Migrations) GetStatementIndex() int64
GetStatementIndex will return the value of StatementIndex.
func (*Migrations) GetStatus ¶
func (m *Migrations) GetStatus() string
GetStatus will return the value of Status.
func (*Migrations) Insert ¶
func (m *Migrations) Insert(opts ...QueryOption) string
Insert starts building an INSERT INTO query.
func (*Migrations) Select ¶
func (m *Migrations) Select(opts ...QueryOption) string
Select starts building a SELECT query.
func (*Migrations) SetFilename ¶
func (m *Migrations) SetFilename(val string)
SetFilename sets Filename to the provided value.
func (*Migrations) SetProject ¶
func (m *Migrations) SetProject(val string)
SetProject sets Project to the provided value.
func (*Migrations) SetStatementIndex ¶
func (m *Migrations) SetStatementIndex(val int64)
SetStatementIndex sets StatementIndex to the provided value.
func (*Migrations) SetStatus ¶
func (m *Migrations) SetStatus(val string)
SetStatus sets Status to the provided value.
func (*Migrations) Update ¶
func (m *Migrations) Update(opts ...QueryOption) string
Update starts building a UPDATE query.
type PulseDaily ¶
type PulseDaily struct {
// User ID
UserID string `db:"user_id" json:"user_id"`
// Hostname
Hostname string `db:"hostname" json:"hostname"`
// Stamp
Stamp *time.Time `db:"stamp" json:"stamp"`
// Count
Count int64 `db:"count" json:"count"`
}
PulseDaily generated for db table `pulse_daily`.
Pulse Daily.
func (*PulseDaily) Delete ¶
func (p *PulseDaily) Delete(opts ...QueryOption) string
Delete starts building a DELETE query.
func (*PulseDaily) GetCount ¶
func (p *PulseDaily) GetCount() int64
GetCount will return the value of Count.
func (*PulseDaily) GetHostname ¶
func (p *PulseDaily) GetHostname() string
GetHostname will return the value of Hostname.
func (*PulseDaily) GetStamp ¶
func (p *PulseDaily) GetStamp() *time.Time
GetStamp will return the value of Stamp.
func (*PulseDaily) GetUserID ¶
func (p *PulseDaily) GetUserID() string
GetUserID will return the value of UserID.
func (*PulseDaily) Insert ¶
func (p *PulseDaily) Insert(opts ...QueryOption) string
Insert starts building an INSERT INTO query.
func (*PulseDaily) Select ¶
func (p *PulseDaily) Select(opts ...QueryOption) string
Select starts building a SELECT query.
func (*PulseDaily) SetCount ¶
func (p *PulseDaily) SetCount(val int64)
SetCount sets Count to the provided value.
func (*PulseDaily) SetHostname ¶
func (p *PulseDaily) SetHostname(val string)
SetHostname sets Hostname to the provided value.
func (*PulseDaily) SetStamp ¶
func (p *PulseDaily) SetStamp(stamp time.Time)
SetStamp sets Stamp to the provided value.
func (*PulseDaily) SetUserID ¶
func (p *PulseDaily) SetUserID(val string)
SetUserID sets UserID to the provided value.
func (*PulseDaily) Update ¶
func (p *PulseDaily) Update(opts ...QueryOption) string
Update starts building a UPDATE query.
type PulseHost ¶
type PulseHost struct {
// User ID
UserID string `db:"user_id" json:"user_id"`
// Hostname
Hostname string `db:"hostname" json:"hostname"`
// Created At
CreatedAt *time.Time `db:"created_at" json:"created_at"`
}
PulseHost generated for db table `pulse_host`.
Pulse Host.
func (*PulseHost) Delete ¶
func (p *PulseHost) Delete(opts ...QueryOption) string
Delete starts building a DELETE query.
func (*PulseHost) GetCreatedAt ¶
GetCreatedAt will return the value of CreatedAt.
func (*PulseHost) GetHostname ¶
GetHostname will return the value of Hostname.
func (*PulseHost) Insert ¶
func (p *PulseHost) Insert(opts ...QueryOption) string
Insert starts building an INSERT INTO query.
func (*PulseHost) Select ¶
func (p *PulseHost) Select(opts ...QueryOption) string
Select starts building a SELECT query.
func (*PulseHost) SetCreatedAt ¶
SetCreatedAt sets CreatedAt to the provided value.
func (*PulseHost) SetHostname ¶
SetHostname sets Hostname to the provided value.
func (*PulseHost) Update ¶
func (p *PulseHost) Update(opts ...QueryOption) string
Update starts building a UPDATE query.
type PulseHourly ¶
type PulseHourly struct {
// User ID
UserID string `db:"user_id" json:"user_id"`
// Hostname
Hostname string `db:"hostname" json:"hostname"`
// Stamp
Stamp *time.Time `db:"stamp" json:"stamp"`
// Count
Count int64 `db:"count" json:"count"`
}
PulseHourly generated for db table `pulse_hourly`.
Pulse Hourly.
func (*PulseHourly) Delete ¶
func (p *PulseHourly) Delete(opts ...QueryOption) string
Delete starts building a DELETE query.
func (*PulseHourly) GetCount ¶
func (p *PulseHourly) GetCount() int64
GetCount will return the value of Count.
func (*PulseHourly) GetHostname ¶
func (p *PulseHourly) GetHostname() string
GetHostname will return the value of Hostname.
func (*PulseHourly) GetStamp ¶
func (p *PulseHourly) GetStamp() *time.Time
GetStamp will return the value of Stamp.
func (*PulseHourly) GetUserID ¶
func (p *PulseHourly) GetUserID() string
GetUserID will return the value of UserID.
func (*PulseHourly) Insert ¶
func (p *PulseHourly) Insert(opts ...QueryOption) string
Insert starts building an INSERT INTO query.
func (*PulseHourly) Select ¶
func (p *PulseHourly) Select(opts ...QueryOption) string
Select starts building a SELECT query.
func (*PulseHourly) SetCount ¶
func (p *PulseHourly) SetCount(val int64)
SetCount sets Count to the provided value.
func (*PulseHourly) SetHostname ¶
func (p *PulseHourly) SetHostname(val string)
SetHostname sets Hostname to the provided value.
func (*PulseHourly) SetStamp ¶
func (p *PulseHourly) SetStamp(stamp time.Time)
SetStamp sets Stamp to the provided value.
func (*PulseHourly) SetUserID ¶
func (p *PulseHourly) SetUserID(val string)
SetUserID sets UserID to the provided value.
func (*PulseHourly) Update ¶
func (p *PulseHourly) Update(opts ...QueryOption) string
Update starts building a UPDATE query.
type QueryConfig ¶
type QueryConfig struct {
Table string
Columns []string
Where string
OrderBy string
LimitStart int
LimitOffset int
Statement string
}
QueryConfig is a function-chaining SQL statement type.
func (*QueryConfig) Apply ¶
func (q *QueryConfig) Apply(opts ...QueryOption) *QueryConfig
Apply will use passed query options to populate the query.
func (*QueryConfig) WithColumns ¶
func (q *QueryConfig) WithColumns(cols []string) QueryOption
WithColumns will set the columns to use for the query.
func (*QueryConfig) WithLimit ¶
func (q *QueryConfig) WithLimit(start, offset int) QueryOption
WithLimit will set the limit clause parameters for the query.
func (*QueryConfig) WithOrderBy ¶
func (q *QueryConfig) WithOrderBy(clause string) QueryOption
WithOrderBy will set the order by clause for the query.
func (*QueryConfig) WithStatement ¶
func (q *QueryConfig) WithStatement(stmt string) QueryOption
WithStatement will change the statement for the query.
func (*QueryConfig) WithTable ¶
func (q *QueryConfig) WithTable(name string) QueryOption
WithTable will set the table name for the query.
func (*QueryConfig) WithWhere ¶
func (q *QueryConfig) WithWhere(clause string) QueryOption
WithWhere will set the where condition for the query.
type QueryOption ¶
type QueryOption interface {
WithTable(name string) QueryOption
WithColumns(cols []string) QueryOption
WithWhere(clause string) QueryOption
WithOrderBy(clause string) QueryOption
WithLimit(start, offset int) QueryOption
WithStatement(stmt string) QueryOption
}
QueryOption is implemented by each data model type.
func WithColumns ¶
func WithColumns(cols []string) QueryOption
WithColumns will set the columns to use for the query.
func WithLimit ¶
func WithLimit(start, offset int) QueryOption
WithLimit will set the limit clause parameters for the query.
func WithOrderBy ¶
func WithOrderBy(clause string) QueryOption
WithOrderBy will set the order by clause for the query.
func WithStatement ¶
func WithStatement(stmt string) QueryOption
WithStatement will change the statement for the query.
func WithTable ¶
func WithTable(name string) QueryOption
WithTable will set the table name for the query.
func WithWhere ¶
func WithWhere(clause string) QueryOption
WithWhere will set the where condition for the query.