search

package
v0.0.0-...-394a65f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter represents the filters for a search request.

func NewFilter

func NewFilter(maxResults int, resources []Resource, orders []order.By) (Filter, error)

NewFilter creates Filter.

type Query

type Query struct {
	Query string
	User  *entity.User
}

Query represents a user query.

type Resource

type Resource uint

Resource represents a type of searchable objects.

const (
	// Unknown implies the resource type is not support by the search module.
	// This is usually used as the fallback resource by the callers of search API.
	Unknown Resource = iota
	// ShortLink represents the short links.
	ShortLink
	// User represents the internal user.
	User
)

type Result

type Result struct {
	ShortLinks []entity.ShortLink
	Users      []entity.User
}

Result represents the result of a search query.

type Search struct {
	// contains filtered or unexported fields
}

Search finds different types of resources matching certain criteria and sort them based on predefined orders.

func NewSearch

func NewSearch(
	logger logger.Logger,
	shortLinkRepo repository.ShortLink,
	userShortLinkRepo repository.UserShortLink,
	timeout time.Duration,
) Search

NewSearch creates Search

func (Search) Search

func (s Search) Search(query Query, filter Filter) (Result, error)

Search finds resources based on specified criteria.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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