mongodb

package
v0.0.0-...-e88f72d Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(conn *Connection) (persistence.Repository, error)

Types

type Connection

type Connection struct {
	Client *mongo.Client
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(uri string) (*Connection, error)

func (*Connection) Collection

func (conn *Connection) Collection(collection string) *mongo.Collection

func (*Connection) Database

func (conn *Connection) Database() *mongo.Database

type Repository

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

func (*Repository) Close

func (r *Repository) Close() error

func (*Repository) DeleteCode

func (r *Repository) DeleteCode(ctx context.Context, code string) error

func (*Repository) GetEntries

func (r *Repository) GetEntries(ctx context.Context, page, size int64) ([]persistence.Shortlink, int64, error)

func (*Repository) GetEntryForCode

func (r *Repository) GetEntryForCode(ctx context.Context, code string) (persistence.Shortlink, error)

func (*Repository) Migrate

func (r *Repository) Migrate(ctx context.Context) error

func (*Repository) SetEntry

func (r *Repository) SetEntry(ctx context.Context, shortlink persistence.Shortlink) error
type Shortlink struct {
	ID  string    `bson:"_id"`
	URL string    `bson:"url"`
	TTL time.Time `bson:"ttl"`
}

Jump to

Keyboard shortcuts

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