filters

package
v0.0.0-...-e0046dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package filters contains a set of options that can be passed to various functions in a generic way

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterOption

type FilterOption func(*Filters) error

FilterOption is a function type for configuring Filters

func WithAvatarURL

func WithAvatarURL(aurl string) FilterOption

WithAvatarURL provides a custom avatar url

func WithColor

func WithColor(color string) FilterOption

WithColor provides a custom color value

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 WithName

func WithName(name string) FilterOption

WithName provides a custom name value

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

func WithUserID

func WithUserID(id string) FilterOption

WithUserID provides a custom [v1.User] id

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) AvatarURL

func (f *Filters) AvatarURL() string

AvatarURL returns the configured avatar url

func (*Filters) Color

func (f *Filters) Color() string

Color returns the custom color value

func (*Filters) Description

func (f *Filters) Description() string

Description returns the custom description value

func (*Filters) EmailAddress

func (f *Filters) EmailAddress() string

EmailAddress returns the configured [v1.User] email address

func (*Filters) FirstName

func (f *Filters) FirstName() string

FirstName returns the configured [v1.User] first name

func (*Filters) ItemID

func (f *Filters) ItemID() string

ItemID returns the configured statusthingv1.StatusThing id

func (*Filters) LastLogin

func (f *Filters) LastLogin() *time.Time

LastLogin gets the last login

func (*Filters) LastName

func (f *Filters) LastName() string

LastName returns the configured [v1.User] last name

func (*Filters) Name

func (f *Filters) Name() string

Name returns the custom name value

func (*Filters) NoteID

func (f *Filters) NoteID() string

NoteID returns the configured statusthingv1.Note id

func (*Filters) NoteText

func (f *Filters) NoteText() string

NoteText gets the value of [Filters.noteText]

func (*Filters) Password

func (f *Filters) Password() string

Password gets the set password

func (*Filters) Status

func (f *Filters) Status() *statusthingv1.Status

Status returns the statusthingv1.Status that was provided

func (*Filters) StatusID

func (f *Filters) StatusID() string

StatusID returns the configured statusthingv1.CustomStatus id

func (*Filters) StatusIDs

func (f *Filters) StatusIDs() []string

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

func (*Filters) UserID

func (f *Filters) UserID() string

UserID returns the configured [v1.User] id

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL