passage

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

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

Go to latest
Published: Jan 17, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, dbConn *db.MongoDB, passage *passagesv2.Passage) (*passagesv2.Passage, error)

Create inserts a new passage into the database.

func Delete

func Delete(ctx context.Context, mg *db.MongoDB, passage *passagesv2.Passage) error

Delete deletes a passage.

func EnsureIndex

func EnsureIndex(ctx context.Context, dbConn *db.MongoDB) error

EnsureIndex in mongodb.

func Id

func Id(i string) func(*ListOpts)

func Lang

func Lang(s string) func(*ListOpts)

func Limit

func Limit(i int) func(*ListOpts)

func List

func List(ctx context.Context, mg *db.MongoDB, optionsList ...func(*ListOpts)) (*passagesv2.PassageList, error)

List returns a list of passages by passage query.

func NewListOpts

func NewListOpts() []func(*ListOpts)

func Offset

func Offset(i int) func(*ListOpts)

Types

type ListOpts

type ListOpts struct {
	Limit  int
	Offset int
	Id     string
	Lang   string
}

ListOpts implements passage's list options struct.

func DefaultOpts

func DefaultOpts() ListOpts

type Passage

type Passage struct {
	ID       primitive.ObjectID     `bson:"_id" json:"id"`
	Text     string                 `json:"text" bson:"text"`
	Language string                 `json:"language" bson:"language"`
	Type     passagesv2.PassageType `json:"type" bson:"type"`
}

Passage to Trim

Jump to

Keyboard shortcuts

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