order

package
v0.0.0-...-5c487ac Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type By

type By uint

By represents the order of resources being sorted in.

const (
	// ByUnsorted keeps the original order of search results.
	ByUnsorted By = iota
	// ByCreatedTimeASC sorts search results based on their creation time.
	ByCreatedTimeASC
)

type CreatedTime

type CreatedTime struct {
}

CreatedTime arranges searchable resources based on when they are created.

func (c CreatedTime) ArrangeShortLinks(shortLinks []entity.ShortLink) []entity.ShortLink

ArrangeShortLinks arranges shortLinks based on CreatedAt.

func (CreatedTime) ArrangeUsers

func (c CreatedTime) ArrangeUsers(users []entity.User) []entity.User

ArrangeUsers arranges users based on CreatedAt.

type Order

type Order interface {
	ArrangeShortLinks(shortLinks []entity.ShortLink) []entity.ShortLink
	ArrangeUsers(users []entity.User) []entity.User
}

Order arranges searchable resources based on predefined properties.

func NewOrder

func NewOrder(by By) Order

NewOrder creates Order.

type Unchanged

type Unchanged struct{}

Unchanged keeps the order of search results untouched.

func (u Unchanged) ArrangeShortLinks(shortLinks []entity.ShortLink) []entity.ShortLink

ArrangeShortLinks keeps the arrangement of shortLinks untouched.

func (Unchanged) ArrangeUsers

func (u Unchanged) ArrangeUsers(users []entity.User) []entity.User

ArrangeUsers keeps the arrangement of users untouched.

Jump to

Keyboard shortcuts

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