models

package
v0.0.0-...-7864f83 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Error Codes
	ErrMaxPinLimitCode = iota + 1000
	ErrMaxNameLimitCode
	ErrFailedConversionCode
	ErrUnknownStatusStringCode
	ErrUnknownTextMatchStringCode
	ErrUnknownSortStringCode
	ErrUnknownFieldStringCode
	ErrRequiredParamCode
	ErrUnauthorizedCode
	ErrProcessingRequestCode
	ErrNotFoundCode
)

Variables

View Source
var ErrorCodeStrings = map[int]string{
	ErrMaxPinLimitCode:            "MAX_PIN_LIMIT",
	ErrMaxNameLimitCode:           "MAX_NAME_LIMIT",
	ErrFailedConversionCode:       "FAILED_CONVERSION",
	ErrUnknownStatusStringCode:    "UNKNOWN_STATUS_STRING",
	ErrUnknownSortStringCode:      "UNKNOWN_SORT_STRING",
	ErrUnknownFieldStringCode:     "UNKNOWN_FIELD_STRING",
	ErrUnknownTextMatchStringCode: "UNKNOWN_MATCH_STRING",
	ErrRequiredParamCode:          "REQUIRED_PARAM",
	ErrUnauthorizedCode:           "UNAUTHORIZED",
	ErrProcessingRequestCode:      "PROCESSING_REQUEST",
	ErrNotFoundCode:               "NOT_FOUND",
}
View Source
var StatusStrings = []string{
	"initialized",
	"queued",
	"pin_queued",
	"unpin_queued",
	"pinning",
	"pinned",
	"unpinning",
	"unpinned",
	"error",
	"undefined",
}
View Source
var TextMatchStrings = []string{
	"exact",
	"iexact",
	"partial",
	"ipartial",
}

Functions

This section is empty.

Types

type Error

type Error struct {
	Reason  string
	Details string
}

func (Error) Error

func (err Error) Error() string

type Failure

type Failure struct {
	Error Error
}

func NewFailure

func NewFailure(reasonCode int, details string) Failure

type Info

type Info map[string]string

func InfoFromString

func InfoFromString(s string) Info

func (Info) Keys

func (i Info) Keys() []string

func (Info) String

func (i Info) String() string

type KeyList

type KeyList []string

func (KeyList) Len

func (k KeyList) Len() int

func (KeyList) Less

func (k KeyList) Less(i, j int) bool

func (KeyList) Swap

func (k KeyList) Swap(i, j int)

type Pin

type Pin struct {
	Cid     string   `json:"cid"`
	Name    string   `json:"name"`
	Origins []string `json:"origins"`
	Meta    Info     `json:"meta"`
}

type PinStatus

type PinStatus struct {
	Id        string   `json:"requestid"`
	Status    string   `json:"status"`
	Created   string   `json:"created"`
	Pin       Pin      `json:"pin"`
	Delegates []string `json:"delegates"`
	Info      Info     `json:"info"`
}

type Pins

type Pins struct {
	Count   int         `json:"count"`
	Total   int         `json:"total"`
	Results []PinStatus `json:"results"`
}

type Status

type Status int
const (
	StatusInit Status = iota
	StatusQueued
	StatusPinQueued
	StatusUnpinQueued
	StatusPinning
	StatusPinned
	StatusUnpinning
	StatusUnpinned
	StatusError
	StatusUndefined
)

func ToStatus

func ToStatus(s string) (Status, error)

func (Status) String

func (s Status) String() (status string)

type TextMatch

type TextMatch int
const (
	TextMatchExact TextMatch = iota
	TextMatchIExact
	TextMatchPartial
	TextMatchIPartial
)

func ToTextMatch

func ToTextMatch(m string) (TextMatch, error)

func (TextMatch) String

func (tm TextMatch) String() (match string)

Jump to

Keyboard shortcuts

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