Documentation ¶
Overview ¶
Package filters contains a set of options that can be passed to various functions in a generic way
Index ¶
- type FilterOption
- func WithAvatarURL(aurl string) FilterOption
- func WithColor(color string) FilterOption
- func WithDescription(description string) FilterOption
- func WithEmailAddress(email string) FilterOption
- func WithFirstName(fname string) FilterOption
- func WithItemID(id string) FilterOption
- func WithLastLogin(lastlogin *time.Time) FilterOption
- func WithLastName(lname string) FilterOption
- func WithName(name string) FilterOption
- func WithNoteID(id string) FilterOption
- func WithNoteText(text string) FilterOption
- func WithPassword(password string) FilterOption
- func WithStatus(s *statusthingv1.Status) FilterOption
- func WithStatusID(id string) FilterOption
- func WithStatusIDs(statusIDs ...string) FilterOption
- func WithStatusKind(k statusthingv1.StatusKind) FilterOption
- func WithStatusKinds(kinds ...statusthingv1.StatusKind) FilterOption
- func WithTimestamps(ts *statusthingv1.Timestamps) FilterOption
- func WithUserID(id string) FilterOption
- type Filters
- func (f *Filters) AvatarURL() string
- func (f *Filters) Color() string
- func (f *Filters) Description() string
- func (f *Filters) EmailAddress() string
- func (f *Filters) FirstName() string
- func (f *Filters) ItemID() string
- func (f *Filters) LastLogin() *time.Time
- func (f *Filters) LastName() string
- func (f *Filters) Name() string
- func (f *Filters) NoteID() string
- func (f *Filters) NoteText() string
- func (f *Filters) Password() string
- func (f *Filters) Status() *statusthingv1.Status
- func (f *Filters) StatusID() string
- func (f *Filters) StatusIDs() []string
- func (f *Filters) StatusKind() statusthingv1.StatusKind
- func (f *Filters) StatusKinds() []statusthingv1.StatusKind
- func (f *Filters) Timestamps() *statusthingv1.Timestamps
- func (f *Filters) UserID() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilterOption ¶
FilterOption is a function type for configuring Filters
func WithAvatarURL ¶
func WithAvatarURL(aurl string) FilterOption
WithAvatarURL provides a custom avatar url
func WithDescription ¶
func WithDescription(description string) FilterOption
WithDescription provides a custom description
func WithEmailAddress ¶
func WithEmailAddress(email string) FilterOption
WithEmailAddress provides a custom [v1.User] email address
func WithFirstName ¶
func WithFirstName(fname string) FilterOption
WithFirstName provides a custom [v1.User] firstname
func WithItemID ¶
func WithItemID(id string) FilterOption
WithItemID provides a custom statusthingv1.StatusThing id
func WithLastLogin ¶
func WithLastLogin(lastlogin *time.Time) FilterOption
WithLastLogin sets the last login
func WithLastName ¶
func WithLastName(lname string) FilterOption
WithLastName provides a custom [v1.User] last name
func WithNoteID ¶
func WithNoteID(id string) FilterOption
WithNoteID provides a custom statusthingv1.Note id
func WithNoteText ¶
func WithNoteText(text string) FilterOption
WithNoteText provides a custom note text for things like updates
func WithPassword ¶
func WithPassword(password string) FilterOption
WithPassword provides a password to a filter
func WithStatus ¶
func WithStatus(s *statusthingv1.Status) FilterOption
WithStatus provides a custom statusthingv1.Status
func WithStatusID ¶
func WithStatusID(id string) FilterOption
WithStatusID provides a custom statusthingv1.CustomStatus id
func WithStatusIDs ¶
func WithStatusIDs(statusIDs ...string) FilterOption
WithStatusIDs provides a custom slice of statusthingv1.CustomStatus ids
func WithStatusKind ¶
func WithStatusKind(k statusthingv1.StatusKind) FilterOption
WithStatusKind provides a custom statusthingv1.StatusKind
func WithStatusKinds ¶
func WithStatusKinds(kinds ...statusthingv1.StatusKind) FilterOption
WithStatusKinds provides a custom slice of statusthingv1.StatusKind
func WithTimestamps ¶
func WithTimestamps(ts *statusthingv1.Timestamps) FilterOption
WithTimestamps provides a custom statusthingv1.Timestamps Note that this is unconcerned with any individual timestamp value You are not required to set any timestamp field and this only checks that the current value is not equal to the existing one
type Filters ¶
type Filters struct {
// contains filtered or unexported fields
}
Filters represent a set of reusable options that can be used in function signatures
func New ¶
func New(opts ...FilterOption) (*Filters, error)
New returns a new Filters configured with the provided FilterOption you should never create a Filters via struct literal for thread safety reasons. Always use filters.New
func (*Filters) Description ¶
Description returns the custom description value
func (*Filters) EmailAddress ¶
EmailAddress returns the configured [v1.User] email address
func (*Filters) ItemID ¶
ItemID returns the configured statusthingv1.StatusThing id
func (*Filters) NoteID ¶
NoteID returns the configured statusthingv1.Note id
func (*Filters) Status ¶
func (f *Filters) Status() *statusthingv1.Status
Status returns the statusthingv1.Status that was provided
func (*Filters) StatusID ¶
StatusID returns the configured statusthingv1.CustomStatus id
func (*Filters) StatusIDs ¶
StatusIDs returns the configured slice of statusthingv1.CustomStatus ids
func (*Filters) StatusKind ¶
func (f *Filters) StatusKind() statusthingv1.StatusKind
StatusKind gets the statusthingv1.StatusKind that was provided
func (*Filters) StatusKinds ¶
func (f *Filters) StatusKinds() []statusthingv1.StatusKind
StatusKinds gets the slice of statusthingv1.StatusKind that was provided
func (*Filters) Timestamps ¶
func (f *Filters) Timestamps() *statusthingv1.Timestamps
Timestamps gets the statusthingv1.Timestamps that was provided when working with any protobuf message always use the getters and they can be safely chained i.e. `if f.Timestamps().GetCreated() == nil ` or `mything := &statusthingv1.StatusThing{}; created := mything.GetTimestamps().GetCreated()` is the only reliable way to check a value