model

package
v0.0.0-...-0cfb223 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoResult indicates that no documents were found
	ErrNoResult = errors.New("no document found")

	// ErrInvalidInput indicates that an input was invalid
	ErrInvalidInput = errors.New("invalid input")

	// ErrInvalidKind indicates that a kind was invalid
	ErrInvalidKind = errors.New("invalid kind")

	// ErrInvalidObjectID indicates that an object ID was invalid
	ErrInvalidObjectID = errors.New("invalid resource id")

	// ErrInternalError indicates that there was an function or backend error
	ErrInternalError = errors.New("server or network error")
)

Functions

func MongoToAPIError

func MongoToAPIError(err error) error

MongoToAPIError converts an MongoDB error to an internal error

Types

type CustomFilter

type CustomFilter struct {
	bson.D
}

CustomFilter describes a custom filter

func (*CustomFilter) Filter

func (f *CustomFilter) Filter() bson.D

Filter implements the DocumentFilter interface

type DocumentFilter

type DocumentFilter interface {
	Filter() bson.D
}

DocumentFilter describes the interface for filtering documents

type ObjectID

type ObjectID = primitive.ObjectID

ObjectID defines an object ID

func ToObjectID

func ToObjectID(id string) (ObjectID, error)

ToObjectID converts a string id to an object ID

type Response

type Response struct {
	Status     string `json:"status"`
	Message    string `json:"message"`
	StatusCode int    `json:"code"`
}

Response describes a status response

func NewResponse

func NewResponse(msg string, code int) *Response

NewResponse creates a new status response based on parameters

type Result

type Result struct {
	Count int64         `json:"total"`
	Items []interface{} `json:"items"`
}

Result describes an result output

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp outputs the time in a Unix timestamp

func (*Timestamp) MarshalJSON

func (t *Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements the JSON marshaler

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the JSON unmarshaler

Directories

Path Synopsis
hideout
statistic

Jump to

Keyboard shortcuts

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