repository

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

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package repository provides the database resources and their rules

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	InsertOne(ctx context.Context, b bson.D) mongo.InsertOneResult
}

type Repository

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

Repository provides a main type to uses the database resources

func New

func New(db DB, tableName string) *Repository

New initiate a Repository pointer

func (Repository) Get

func (r Repository) Get(ctx context.Context, id string) (string, error)

func (Repository) List

func (r Repository) List(ctx context.Context) ([]string, error)

func (Repository) Shorten

func (r Repository) Shorten(ctx context.Context, u string) (string, error)

Jump to

Keyboard shortcuts

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