search

package
v0.0.0-...-1945791 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close ends the elastic search connection

func InsertMeow

func InsertMeow(ctx context.Context, meow schema.Meow) error

InsertMeow inserts the type into search engine

func SearchMeows

func SearchMeows(ctx context.Context, query string, skip uint64, take uint64) ([]schema.Meow, error)

SearchMeows seeks for Meows into search engine

func SetRepository

func SetRepository(repository Repository)

SetRepository sets the repository through dependency injection

Types

type ElasticRepository

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

ElasticRepository implements the Repository interface

func NewElastic

func NewElastic(url string) (*ElasticRepository, error)

NewElastic connects to elasticsearch engine

func (*ElasticRepository) Close

func (r *ElasticRepository) Close()

Close closes the connection with Elasticsearch

func (*ElasticRepository) InsertMeow

func (r *ElasticRepository) InsertMeow(ctx context.Context, meow schema.Meow) error

InsertMeow inserts a new meow into search engine

func (*ElasticRepository) SearchMeows

func (r *ElasticRepository) SearchMeows(ctx context.Context, query string, skip uint64, take uint64) ([]schema.Meow, error)

SearchMeows seek for a query term into search engine

type Repository

type Repository interface {
	Close()
	InsertMeow(ctx context.Context, meow schema.Meow) error
	SearchMeows(ctx context.Context, query string, skip uint64, take uint64) ([]schema.Meow, error)
}

Repository is an interface for handling search operations

Jump to

Keyboard shortcuts

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