Documentation ¶
Index ¶
- Constants
- Variables
- type Datable
- type Identificable
- type Identification
- type Ownable
- type Ownership
- type Pagination
- type Status
- func (s *Status) GetMessage() string
- func (s *Status) GetStatus() StatusType
- func (s *Status) IsFinal() bool
- func (s *Status) IsValid() bool
- func (s *Status) SetActive()
- func (s *Status) SetCanceled()
- func (s *Status) SetDeleted()
- func (s *Status) SetDeleting()
- func (s *Status) SetDone()
- func (s *Status) SetFailed()
- func (s *Status) SetNew()
- func (s *Status) SetPaused()
- func (s *Status) SetScheduled()
- type StatusType
- type Statusable
- type Timeable
- type Timestamp
Constants ¶
const ( // StatusDone the thing is done StatusDone = StatusType("done") // StatusNew the thing is just created StatusNew = StatusType("new") // StatusScheduled the thing is scheduled (has a date when it will start) StatusScheduled = StatusType("scheduled") // StatusActive means the thing is active (has been consume) StatusActive = StatusType("active") // StatusFailed the thing failed and has an error StatusFailed = StatusType("failed") // StatusCanceled the thing has been canceled for some reason StatusCanceled = StatusType("canceled") // StatusPaused the thing has been paused for some reason StatusPaused = StatusType("paused") // StatusSkipped the thing has been skipped for some reason StatusSkipped = StatusType("skipped") // StatusDeleted the thing has been deleted for some reason StatusDeleted = StatusType("deleted") // StatusDeleting something that as been marked to be deleted StatusDeleting = StatusType("deleting") )
Variables ¶
var ValidStatusTypes = map[StatusType]StatusType{ StatusDone: StatusDone, StatusNew: StatusNew, StatusScheduled: StatusScheduled, StatusFailed: StatusFailed, StatusCanceled: StatusCanceled, StatusDeleted: StatusDeleted, StatusDeleting: StatusDeleting, StatusActive: StatusActive, }
ValidStatusTypes valid types of permissions
Functions ¶
This section is empty.
Types ¶
type Datable ¶
type Datable interface { Identificable Timeable Ownable GetServicePrn() string }
Datable Db data
type Identificable ¶
type Identificable interface { GetID() string GetPrn() string SetPrn(service string) Identificable }
Identificable interface of something with ID
type Identification ¶
Identification identification fields for a model
func NewIdentification ¶
func NewIdentification(service string) Identification
NewIdentification Create new indentification
func (*Identification) GetID ¶
func (identification *Identification) GetID() string
GetID get the id of a Identification
func (*Identification) GetPrn ¶
func (identification *Identification) GetPrn() string
GetPrn get the id of a Identification
func (*Identification) SetPrn ¶
func (identification *Identification) SetPrn(service string) Identificable
GetID get the id of a Identification
type Ownable ¶
type Ownable interface { GetOwnerID() string GetOwnerPrn() string SetOwnerPrn(service string) Ownable }
Ownable interface of something with ID
type Ownership ¶
type Ownership struct { OwnerID string `json:"owner_id" bson:"owner_id"` OwnerPrn string `json:"owner" bson:"owner"` }
Ownership define owner of a resource
func (*Ownership) GetOwnerID ¶
GetOwnerID get the id of a owner
func (*Ownership) GetOwnerPrn ¶
GetOwnerPrn get the prn of a owner
func (*Ownership) SetOwnerPrn ¶
SetOwnerPrn set the prn of a owner
type Pagination ¶
type Pagination struct { PageSizes []int `json:"-"` ServiceURL string `json:"resource"` PageSize int `json:"page_size"` PageOffset int `json:"page_offset"` CurrentPage int `json:"current_page"` Total int `json:"total"` Next string `json:"next"` Prev string `json:"prev"` }
Pagination paginable response
type Status ¶
type Status struct { State StatusType `json:"state" bson:"state"` Message string `json:"message" bson:"message"` }
Status status for a collection
func (*Status) SetScheduled ¶
func (s *Status) SetScheduled()
SetScheduled set the status as Scheduled
type Statusable ¶
type Statusable interface { SetDone() SetNew() SetScheduled() SetFailed() SetCanceled() SetDeleted() SetPaused() SetDeleting() SetActive() GetStatus() StatusType GetMessage() string IsFinal() bool IsValid() bool }
Statusable make something Status able
type Timeable ¶
type Timeable interface { SetCreatedAt() SetUpdatedAt() SetDeletedAt() GetCreatedAt() *time.Time GetUpdatedAt() *time.Time GetDeletedAt() *time.Time }
Timeable interface of something with TimeStamp
type Timestamp ¶
type Timestamp struct { DeletedAt *time.Time `json:"deleted_at,omitempty" bson:"deleted_at"` CreatedAt *time.Time `json:"created_at,omitempty" bson:"created_at"` UpdatedAt *time.Time `json:"updated_at,omitempty" bson:"updated_at"` }
Timestamp timestamp extension for all models
func (*Timestamp) GetCreatedAt ¶
GetCreatedAt get method for created at
func (*Timestamp) GetDeletedAt ¶
GetDeletedAt get method for deleted at
func (*Timestamp) GetUpdatedAt ¶
GetUpdatedAt get method for updated at
func (*Timestamp) SetDeletedAt ¶
func (t *Timestamp) SetDeletedAt()
SetDeletedAt set delete to a timestamp
func (*Timestamp) SetUpdatedAt ¶
func (t *Timestamp) SetUpdatedAt()
SetUpdatedAt set update to a timestamp