gorse

package
v0.0.0-...-3f52ee8 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Client

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

func New

func New(url string, key string, timeout time.Duration) *Client

func (*Client) DeleteSeen

func (c *Client) DeleteSeen(ctx context.Context, user string, item string) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, item string) (string, error)

func (*Client) Has

func (c *Client) Has(ctx context.Context, item string) (bool, error)

func (*Client) Insert

func (c *Client) Insert(
	ctx context.Context,
	item string,
	comment string,
	schema string,
	searcher string,
) error

WARNING: Overwrites item if exists

func (*Client) Latest

func (c *Client) Latest(ctx context.Context, schema string) (string, int64, string, error)

func (*Client) Rate

func (c *Client) Rate(ctx context.Context, user string, item string, feedback FeedbackType) error

func (*Client) Recommend

func (c *Client) Recommend(
	ctx context.Context,
	user string,
	schema string,
) (string, string, error)

func (*Client) Unrated

func (c *Client) Unrated(ctx context.Context, user string) ([]*Feedback, error)

type ErrorMessage

type ErrorMessage string

func (ErrorMessage) Error

func (e ErrorMessage) Error() string

type Feedback

type Feedback struct {
	FeedbackType string `json:"FeedbackType"`
	UserId       string `json:"UserId"`
	ItemId       string `json:"ItemId"`
	Timestamp    string `json:"Timestamp"`
}

type FeedbackType

type FeedbackType string
const (
	Like         FeedbackType = "like"
	Dislike      FeedbackType = "dislike"
	Skip         FeedbackType = "skip"
	Junk         FeedbackType = "junk"
	Inaccessible FeedbackType = "inaccessible"
	Abuse        FeedbackType = "abuse"
)

func ParseFeedback

func ParseFeedback(f []byte) (FeedbackType, error)

func (FeedbackType) Value

func (f FeedbackType) Value() []byte

type Item

type Item struct {
	ItemId     string   `json:"ItemId"`
	IsHidden   bool     `json:"IsHidden"`
	Labels     []string `json:"Labels"`
	Categories []string `json:"Categories"`
	Timestamp  string   `json:"Timestamp"`
	Comment    string   `json:"Comment"`
}

type LatestItem

type LatestItem struct {
	Id    string `json:"Id"`
	Score int64  `json:"Score"` // timestamp
}

type RowAffected

type RowAffected struct {
	RowAffected int `json:"RowAffected"`
}

type User

type User struct {
	UserId    string   `json:"UserId"`
	Labels    []string `json:"Labels"`
	Subscribe []string `json:"Subscribe"`
	Comment   string   `json:"Comment"`
}

Jump to

Keyboard shortcuts

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