Documentation ¶
Overview ¶
IMPORTANT! This is auto generated code by https://github.com/src-d/go-kallax Please, do not touch the code below, and if you do, do it under your own risk. Take into account that all the code you write here will be completely erased from earth the next time you generate the kallax models.
Index ¶
- Variables
- func IncrIDCounter() (next int64)
- func InitStores()
- func QueueMessage(source, sourceID string, channel int64, msgStr string, ...)
- func QueueMessageEmbed(source, sourceID string, channel int64, embed *discordgo.MessageEmbed)
- func QueueMessageString(source, sourceID string, channel int64, message string)
- func RegisterPlugin()
- func RegisterSource(name string, source PluginWithErrorHandler)
- type Plugin
- type PluginWithErrorHandler
- type QueuedElement
- func (r *QueuedElement) ColumnAddress(col string) (interface{}, error)
- func (r *QueuedElement) GetID() kallax.Identifier
- func (r *QueuedElement) NewRelationshipRecord(field string) (kallax.Record, error)
- func (r *QueuedElement) SetRelationship(field string, rel interface{}) error
- func (r *QueuedElement) Value(col string) (interface{}, error)
- type QueuedElementNoKallax
- type QueuedElementQuery
- func (q *QueuedElementQuery) BatchSize(size uint64) *QueuedElementQuery
- func (q *QueuedElementQuery) Copy() *QueuedElementQuery
- func (q *QueuedElementQuery) FindByChannel(v string) *QueuedElementQuery
- func (q *QueuedElementQuery) FindByID(v ...int64) *QueuedElementQuery
- func (q *QueuedElementQuery) FindByMessageEmbed(v string) *QueuedElementQuery
- func (q *QueuedElementQuery) FindByMessageStr(v string) *QueuedElementQuery
- func (q *QueuedElementQuery) FindByProcessed(v bool) *QueuedElementQuery
- func (q *QueuedElementQuery) FindBySource(v string) *QueuedElementQuery
- func (q *QueuedElementQuery) FindBySourceID(v string) *QueuedElementQuery
- func (q *QueuedElementQuery) Limit(n uint64) *QueuedElementQuery
- func (q *QueuedElementQuery) Offset(n uint64) *QueuedElementQuery
- func (q *QueuedElementQuery) Order(cols ...kallax.ColumnOrder) *QueuedElementQuery
- func (q *QueuedElementQuery) Select(columns ...kallax.SchemaField) *QueuedElementQuery
- func (q *QueuedElementQuery) SelectNot(columns ...kallax.SchemaField) *QueuedElementQuery
- func (q *QueuedElementQuery) Where(cond kallax.Condition) *QueuedElementQuery
- type QueuedElementResultSet
- func (rs *QueuedElementResultSet) All() ([]*QueuedElement, error)
- func (rs *QueuedElementResultSet) Close() error
- func (rs *QueuedElementResultSet) Err() error
- func (rs *QueuedElementResultSet) ForEach(fn func(*QueuedElement) error) error
- func (rs *QueuedElementResultSet) Get() (*QueuedElement, error)
- func (rs *QueuedElementResultSet) Next() bool
- func (rs *QueuedElementResultSet) One() (*QueuedElement, error)
- type QueuedElementStore
- func (s *QueuedElementStore) Count(q *QueuedElementQuery) (int64, error)
- func (s *QueuedElementStore) Debug() *QueuedElementStore
- func (s *QueuedElementStore) DebugWith(logger kallax.LoggerFunc) *QueuedElementStore
- func (s *QueuedElementStore) Delete(record *QueuedElement) error
- func (s *QueuedElementStore) Find(q *QueuedElementQuery) (*QueuedElementResultSet, error)
- func (s *QueuedElementStore) FindAll(q *QueuedElementQuery) ([]*QueuedElement, error)
- func (s *QueuedElementStore) FindOne(q *QueuedElementQuery) (*QueuedElement, error)
- func (s *QueuedElementStore) GenericStore() *kallax.Store
- func (s *QueuedElementStore) Insert(record *QueuedElement) error
- func (s *QueuedElementStore) MustCount(q *QueuedElementQuery) int64
- func (s *QueuedElementStore) MustFind(q *QueuedElementQuery) *QueuedElementResultSet
- func (s *QueuedElementStore) MustFindOne(q *QueuedElementQuery) *QueuedElement
- func (s *QueuedElementStore) Reload(record *QueuedElement) error
- func (s *QueuedElementStore) Save(record *QueuedElement) (updated bool, err error)
- func (s *QueuedElementStore) SetGenericStore(store *kallax.Store)
- func (s *QueuedElementStore) Transaction(callback func(*QueuedElementStore) error) error
- func (s *QueuedElementStore) Update(record *QueuedElement, cols ...kallax.SchemaField) (updated int64, err error)
- type WorkItem
Constants ¶
This section is empty.
Variables ¶
var Schema = &schema{ QueuedElement: &schemaQueuedElement{ BaseSchema: kallax.NewBaseSchema( "mqueue", "__queuedelement", kallax.NewSchemaField("id"), kallax.ForeignKeys{}, func() kallax.Record { return new(QueuedElement) }, true, kallax.NewSchemaField("id"), kallax.NewSchemaField("source"), kallax.NewSchemaField("source_id"), kallax.NewSchemaField("message_str"), kallax.NewSchemaField("message_embed"), kallax.NewSchemaField("channel"), kallax.NewSchemaField("processed"), ), ID: kallax.NewSchemaField("id"), Source: kallax.NewSchemaField("source"), SourceID: kallax.NewSchemaField("source_id"), MessageStr: kallax.NewSchemaField("message_str"), MessageEmbed: kallax.NewSchemaField("message_embed"), Channel: kallax.NewSchemaField("channel"), Processed: kallax.NewSchemaField("processed"), }, }
Functions ¶
func IncrIDCounter ¶ added in v1.4.7
func IncrIDCounter() (next int64)
func InitStores ¶
func InitStores()
func QueueMessage ¶ added in v1.4.7
func QueueMessage(source, sourceID string, channel int64, msgStr string, embed *discordgo.MessageEmbed)
func QueueMessageEmbed ¶
func QueueMessageEmbed(source, sourceID string, channel int64, embed *discordgo.MessageEmbed)
func QueueMessageString ¶
func RegisterPlugin ¶ added in v1.4.1
func RegisterPlugin()
func RegisterSource ¶
func RegisterSource(name string, source PluginWithErrorHandler)
Types ¶
type PluginWithErrorHandler ¶
type PluginWithErrorHandler interface {
HandleMQueueError(elem *QueuedElementNoKallax, err error)
}
type QueuedElement ¶
type QueuedElement struct { kallax.Model `table:"mqueue" pk:"id,autoincr"` ID int64 // Where this feed originated from, responsible for handling discord specific errors Source string // Could be stuff like reddit feed element id, youtube feed element id and so on SourceID string // The actual message as a simple string MessageStr string // The actual message as an embed MessageEmbed string // The channel to send the message in Channel string Processed bool }
func NewQueuedElement ¶
func NewQueuedElement() (record *QueuedElement)
NewQueuedElement returns a new instance of QueuedElement.
func (*QueuedElement) ColumnAddress ¶
func (r *QueuedElement) ColumnAddress(col string) (interface{}, error)
ColumnAddress returns the pointer to the value of the given column.
func (*QueuedElement) GetID ¶
func (r *QueuedElement) GetID() kallax.Identifier
GetID returns the primary key of the model.
func (*QueuedElement) NewRelationshipRecord ¶
func (r *QueuedElement) NewRelationshipRecord(field string) (kallax.Record, error)
NewRelationshipRecord returns a new record for the relatiobship in the given field.
func (*QueuedElement) SetRelationship ¶
func (r *QueuedElement) SetRelationship(field string, rel interface{}) error
SetRelationship sets the given relationship in the given field.
func (*QueuedElement) Value ¶
func (r *QueuedElement) Value(col string) (interface{}, error)
Value returns the value of the given column.
type QueuedElementNoKallax ¶ added in v1.4.7
type QueuedElementNoKallax struct { ID int64 // Where this feed originated from, responsible for handling discord specific errors Source string // Could be stuff like reddit feed element id, youtube feed element id and so on SourceID string // The actual message as a simple string MessageStr string `json:",omitempty"` // The actual message as an embed MessageEmbed *discordgo.MessageEmbed `json:",omitempty"` // The channel to send the message in Channel int64 }
func NewElemFromKallax ¶ added in v1.4.7
func NewElemFromKallax(existing *QueuedElement) *QueuedElementNoKallax
type QueuedElementQuery ¶
type QueuedElementQuery struct {
*kallax.BaseQuery
}
QueuedElementQuery is the object used to create queries for the QueuedElement entity.
func NewQueuedElementQuery ¶
func NewQueuedElementQuery() *QueuedElementQuery
NewQueuedElementQuery returns a new instance of QueuedElementQuery.
func (*QueuedElementQuery) BatchSize ¶
func (q *QueuedElementQuery) BatchSize(size uint64) *QueuedElementQuery
BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.
func (*QueuedElementQuery) Copy ¶
func (q *QueuedElementQuery) Copy() *QueuedElementQuery
Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.
func (*QueuedElementQuery) FindByChannel ¶
func (q *QueuedElementQuery) FindByChannel(v string) *QueuedElementQuery
FindByChannel adds a new filter to the query that will require that the Channel property is equal to the passed value.
func (*QueuedElementQuery) FindByID ¶
func (q *QueuedElementQuery) FindByID(v ...int64) *QueuedElementQuery
FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.
func (*QueuedElementQuery) FindByMessageEmbed ¶
func (q *QueuedElementQuery) FindByMessageEmbed(v string) *QueuedElementQuery
FindByMessageEmbed adds a new filter to the query that will require that the MessageEmbed property is equal to the passed value.
func (*QueuedElementQuery) FindByMessageStr ¶
func (q *QueuedElementQuery) FindByMessageStr(v string) *QueuedElementQuery
FindByMessageStr adds a new filter to the query that will require that the MessageStr property is equal to the passed value.
func (*QueuedElementQuery) FindByProcessed ¶
func (q *QueuedElementQuery) FindByProcessed(v bool) *QueuedElementQuery
FindByProcessed adds a new filter to the query that will require that the Processed property is equal to the passed value.
func (*QueuedElementQuery) FindBySource ¶
func (q *QueuedElementQuery) FindBySource(v string) *QueuedElementQuery
FindBySource adds a new filter to the query that will require that the Source property is equal to the passed value.
func (*QueuedElementQuery) FindBySourceID ¶
func (q *QueuedElementQuery) FindBySourceID(v string) *QueuedElementQuery
FindBySourceID adds a new filter to the query that will require that the SourceID property is equal to the passed value.
func (*QueuedElementQuery) Limit ¶
func (q *QueuedElementQuery) Limit(n uint64) *QueuedElementQuery
Limit sets the max number of items to retrieve.
func (*QueuedElementQuery) Offset ¶
func (q *QueuedElementQuery) Offset(n uint64) *QueuedElementQuery
Offset sets the number of items to skip from the result set of items.
func (*QueuedElementQuery) Order ¶
func (q *QueuedElementQuery) Order(cols ...kallax.ColumnOrder) *QueuedElementQuery
Order adds order clauses to the query for the given columns.
func (*QueuedElementQuery) Select ¶
func (q *QueuedElementQuery) Select(columns ...kallax.SchemaField) *QueuedElementQuery
Select adds columns to select in the query.
func (*QueuedElementQuery) SelectNot ¶
func (q *QueuedElementQuery) SelectNot(columns ...kallax.SchemaField) *QueuedElementQuery
SelectNot excludes columns from being selected in the query.
func (*QueuedElementQuery) Where ¶
func (q *QueuedElementQuery) Where(cond kallax.Condition) *QueuedElementQuery
Where adds a condition to the query. All conditions added are concatenated using a logical AND.
type QueuedElementResultSet ¶
type QueuedElementResultSet struct { ResultSet kallax.ResultSet // contains filtered or unexported fields }
QueuedElementResultSet is the set of results returned by a query to the database.
func NewQueuedElementResultSet ¶
func NewQueuedElementResultSet(rs kallax.ResultSet) *QueuedElementResultSet
NewQueuedElementResultSet creates a new result set for rows of the type QueuedElement.
func (*QueuedElementResultSet) All ¶
func (rs *QueuedElementResultSet) All() ([]*QueuedElement, error)
All returns all records on the result set and closes the result set.
func (*QueuedElementResultSet) Close ¶
func (rs *QueuedElementResultSet) Close() error
Close closes the result set.
func (*QueuedElementResultSet) Err ¶
func (rs *QueuedElementResultSet) Err() error
Err returns the last error occurred.
func (*QueuedElementResultSet) ForEach ¶
func (rs *QueuedElementResultSet) ForEach(fn func(*QueuedElement) error) error
ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.
func (*QueuedElementResultSet) Get ¶
func (rs *QueuedElementResultSet) Get() (*QueuedElement, error)
Get retrieves the last fetched item from the result set and the last error.
func (*QueuedElementResultSet) Next ¶
func (rs *QueuedElementResultSet) Next() bool
Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.
func (*QueuedElementResultSet) One ¶
func (rs *QueuedElementResultSet) One() (*QueuedElement, error)
One returns the first record on the result set and closes the result set.
type QueuedElementStore ¶
type QueuedElementStore struct {
*kallax.Store
}
QueuedElementStore is the entity to access the records of the type QueuedElement in the database.
func NewQueuedElementStore ¶
func NewQueuedElementStore(db *sql.DB) *QueuedElementStore
NewQueuedElementStore creates a new instance of QueuedElementStore using a SQL database.
func (*QueuedElementStore) Count ¶
func (s *QueuedElementStore) Count(q *QueuedElementQuery) (int64, error)
Count returns the number of rows that would be retrieved with the given query.
func (*QueuedElementStore) Debug ¶
func (s *QueuedElementStore) Debug() *QueuedElementStore
Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.
func (*QueuedElementStore) DebugWith ¶
func (s *QueuedElementStore) DebugWith(logger kallax.LoggerFunc) *QueuedElementStore
DebugWith returns a new store that will print all SQL statements using the given logger function.
func (*QueuedElementStore) Delete ¶
func (s *QueuedElementStore) Delete(record *QueuedElement) error
Delete removes the given record from the database.
func (*QueuedElementStore) Find ¶
func (s *QueuedElementStore) Find(q *QueuedElementQuery) (*QueuedElementResultSet, error)
Find returns the set of results for the given query.
func (*QueuedElementStore) FindAll ¶
func (s *QueuedElementStore) FindAll(q *QueuedElementQuery) ([]*QueuedElement, error)
FindAll returns a list of all the rows returned by the given query.
func (*QueuedElementStore) FindOne ¶
func (s *QueuedElementStore) FindOne(q *QueuedElementQuery) (*QueuedElement, error)
FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.
func (*QueuedElementStore) GenericStore ¶
func (s *QueuedElementStore) GenericStore() *kallax.Store
GenericStore returns the generic store of this store.
func (*QueuedElementStore) Insert ¶
func (s *QueuedElementStore) Insert(record *QueuedElement) error
Insert inserts a QueuedElement in the database. A non-persisted object is required for this operation.
func (*QueuedElementStore) MustCount ¶
func (s *QueuedElementStore) MustCount(q *QueuedElementQuery) int64
MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.
func (*QueuedElementStore) MustFind ¶
func (s *QueuedElementStore) MustFind(q *QueuedElementQuery) *QueuedElementResultSet
MustFind returns the set of results for the given query, but panics if there is any error.
func (*QueuedElementStore) MustFindOne ¶
func (s *QueuedElementStore) MustFindOne(q *QueuedElementQuery) *QueuedElement
MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.
func (*QueuedElementStore) Reload ¶
func (s *QueuedElementStore) Reload(record *QueuedElement) error
Reload refreshes the QueuedElement with the data in the database and makes it writable.
func (*QueuedElementStore) Save ¶
func (s *QueuedElementStore) Save(record *QueuedElement) (updated bool, err error)
Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.
func (*QueuedElementStore) SetGenericStore ¶
func (s *QueuedElementStore) SetGenericStore(store *kallax.Store)
SetGenericStore changes the generic store of this store.
func (*QueuedElementStore) Transaction ¶
func (s *QueuedElementStore) Transaction(callback func(*QueuedElementStore) error) error
Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.
func (*QueuedElementStore) Update ¶
func (s *QueuedElementStore) Update(record *QueuedElement, cols ...kallax.SchemaField) (updated int64, err error)
Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.