meili

package
v0.0.0-...-782a1cc Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DocFilterableAttrs     = []string{"namespace", "id", "entryId", "kind", "name", "source", "webUrl", "createdAt", "updatedAt"}
	DocSortAttrs           = []string{"createdAt", "updatedAt", "name"}
	DocAttrFilterableAttrs = []string{"namespace", "entryId", "key", "id", "kind", "value"}
	DocAttrSortAttrs       = []string{"createdAt", "updatedAt"}
)

Functions

func NewMeiliClient

func NewMeiliClient(conf config.Config) (store.DocStoreInterface, error)

Types

type AttrQuery

type AttrQuery struct {
	Attr   string
	Option string
	Value  interface{}
}

func (*AttrQuery) String

func (aq *AttrQuery) String() string

func (*AttrQuery) ToFilter

func (aq *AttrQuery) ToFilter() interface{}

type Client

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

func (*Client) CreateDocument

func (c *Client) CreateDocument(ctx context.Context, doc *doc.Document) error

func (*Client) DeleteDocument

func (c *Client) DeleteDocument(ctx context.Context, entryId int64) error

func (*Client) FilterDocuments

func (c *Client) FilterDocuments(ctx context.Context, filter *doc.DocumentFilter) ([]*doc.Document, error)

func (*Client) GetDocument

func (c *Client) GetDocument(ctx context.Context, entryId int64) (*doc.Document, error)

func (*Client) UpdateDocument

func (c *Client) UpdateDocument(ctx context.Context, doc *doc.Document) error

type DocPtrInterface

type DocPtrInterface interface {
	ID() string
	EntryID() string
	Type() string
	String() string
}

type Document

type Document struct {
	Id        string `json:"id"`
	Kind      string `json:"kind"`
	Namespace string `json:"namespace"`
	EntryId   string `json:"entryId"`
	Name      string `json:"name"`
	Source    string `json:"source,omitempty"`
	WebUrl    string `json:"webUrl,omitempty"`

	Content     string `json:"content"`
	Summary     string `json:"summary,omitempty"`
	HeaderImage string `json:"headerImage,omitempty"`
	SubContent  string `json:"subContent,omitempty"`

	CreatedAt int64 `json:"createdAt,omitempty"`
	UpdatedAt int64 `json:"updatedAt,omitempty"`
}

func (*Document) EntryID

func (d *Document) EntryID() string

func (*Document) FromModel

func (d *Document) FromModel(doc *doc.Document) *Document

func (*Document) ID

func (d *Document) ID() string

func (*Document) String

func (d *Document) String() string

func (*Document) ToModel

func (d *Document) ToModel(attrs []*DocumentAttr) *doc.Document

func (*Document) Type

func (d *Document) Type() string

type DocumentAttr

type DocumentAttr struct {
	Id        string      `json:"id"`
	Kind      string      `json:"kind"`
	Namespace string      `json:"namespace"`
	EntryId   string      `json:"entryId"`
	Key       string      `json:"key"`
	Value     interface{} `json:"value"`
}

func (*DocumentAttr) EntryID

func (d *DocumentAttr) EntryID() string

func (*DocumentAttr) ID

func (d *DocumentAttr) ID() string

func (*DocumentAttr) NewTest

func (d *DocumentAttr) NewTest() *DocumentAttr

func (*DocumentAttr) String

func (d *DocumentAttr) String() string

func (*DocumentAttr) Type

func (d *DocumentAttr) Type() string

type DocumentAttrList

type DocumentAttrList []*DocumentAttr

func (*DocumentAttrList) FromModel

func (d *DocumentAttrList) FromModel(doc *doc.Document) *DocumentAttrList

func (*DocumentAttrList) String

func (d *DocumentAttrList) String() string

type DocumentAttrQueries

type DocumentAttrQueries []*DocumentAttrQuery

func (*DocumentAttrQueries) FromFilter

func (*DocumentAttrQueries) String

func (q *DocumentAttrQueries) String() string

type DocumentAttrQuery

type DocumentAttrQuery struct {
	AttrQueries []*AttrQuery
}

func (*DocumentAttrQuery) FromModel

func (q *DocumentAttrQuery) FromModel(doc *doc.Document) *DocumentAttrQuery

func (*DocumentAttrQuery) OfEntryId

func (q *DocumentAttrQuery) OfEntryId(namespace, entryId string) *DocumentAttrQuery

func (*DocumentAttrQuery) String

func (q *DocumentAttrQuery) String() string

func (*DocumentAttrQuery) ToFilter

func (q *DocumentAttrQuery) ToFilter() interface{}

func (*DocumentAttrQuery) ToRequest

func (q *DocumentAttrQuery) ToRequest() *meilisearch.SearchRequest

type DocumentList

type DocumentList []*Document

func (DocumentList) String

func (d DocumentList) String() string

type DocumentQuery

type DocumentQuery struct {
	AttrQueries []*AttrQuery

	Search      string
	HitsPerPage int64
	Page        int64
	Offset      int64
	Limit       int64
	Sort        []Sort
}

func (*DocumentQuery) FromModel

func (q *DocumentQuery) FromModel(query *doc.DocumentFilter) *DocumentQuery

func (*DocumentQuery) OfEntryId

func (q *DocumentQuery) OfEntryId(namespace string, entryId int64) *DocumentQuery

func (*DocumentQuery) String

func (q *DocumentQuery) String() string

func (*DocumentQuery) ToFilter

func (q *DocumentQuery) ToFilter() interface{}

func (*DocumentQuery) ToRequest

func (q *DocumentQuery) ToRequest() *meilisearch.SearchRequest

type MockClient

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

func (*MockClient) CreateDocument

func (m *MockClient) CreateDocument(ctx context.Context, doc *doc.Document) error

func (*MockClient) DeleteDocument

func (m *MockClient) DeleteDocument(ctx context.Context, docId int64) error

func (*MockClient) FilterDocuments

func (m *MockClient) FilterDocuments(ctx context.Context, filter *doc.DocumentFilter) ([]*doc.Document, error)

func (*MockClient) GetDocument

func (m *MockClient) GetDocument(ctx context.Context, entryId int64) (*doc.Document, error)

func (*MockClient) UpdateDocument

func (m *MockClient) UpdateDocument(ctx context.Context, doc *doc.Document) error

type Sort

type Sort struct {
	Attr string
	Asc  bool
}

func (*Sort) String

func (s *Sort) String() string

Jump to

Keyboard shortcuts

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