Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNoObjectsFound ¶
Auxiliary function to determine whether or not an error is a NoObjectsFound error.
Types ¶
type Archetype ¶
type Archetype interface { // Should mutate the ID field to the value of the paramter. SetID(string) // Should mutate the ID field to a zero value. Eg. the empty string ("") UnsetID() // Should mutate the CreatedAt and UpdatedAt (or alternatively named) fields // to the current time (preferably UTC+0) Created() // Should only mutate the UpdateAt (or similar) field to the current // time (preferably UTC+0). Updated() }
All types should implement this interface so as to be compatible with the various sub-packages.
type Channel ¶
Represents a group of users listening to a data stream.
func ChannelFromCtx ¶
Get a channel from a context.
func (*Channel) PasswordStr ¶
Retrieve the channel's password as a string.
func (*Channel) SetPasswordStr ¶
Mutate the channel's password to the string provided.
type ChannelRepo ¶
type ChannelRepo interface { // Get all channels All(context.Context) ([]Channel, error) // Create a new channel Insert(context.Context, Archetype) error // Find a channel by its ID. FindID(context.Context, string) (*Channel, error) // Find and update a channel by its ID. UpdateID(context.Context, string, Archetype) error // Find and delete a channel by its ID. DeleteID(context.Context, string) (*Channel, error) // Get a count of channels. Count(context.Context) (int64, error) }
type Common ¶
type Common struct { ID string `json:"id" bson:"_id,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
Implements Archetype and is intended to be used in domain types via struct composition.
type ContextEmbeddable ¶
Types implementing this interface can be stored in a context.
type NoObjectsFound ¶
type NoObjectsFound struct {
// contains filtered or unexported fields
}
Returned from repositories when a query returns nothing. NoObjectsFound implements error.
func NewNoObjectsFound ¶
func NewNoObjectsFound(r, q string) *NoObjectsFound
Create a new NoObjectsFoundError specifying the repository (eg. "users") and the query value (eg. "id == 7").
func (*NoObjectsFound) Error ¶
func (e *NoObjectsFound) Error() string