Documentation ¶
Index ¶
- func New(conn *Connection) (persistence.Repository, error)
- type Connection
- type Repository
- func (r *Repository) Close() error
- func (r *Repository) DeleteCode(ctx context.Context, code string) error
- func (r *Repository) GetEntries(ctx context.Context, page, size int64) ([]persistence.Shortlink, int64, error)
- func (r *Repository) GetEntryForCode(ctx context.Context, code string) (persistence.Shortlink, error)
- func (r *Repository) Migrate(ctx context.Context) error
- func (r *Repository) SetEntry(ctx context.Context, shortlink persistence.Shortlink) error
- type Shortlink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(conn *Connection) (persistence.Repository, error)
Types ¶
type Connection ¶
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) SetEntry ¶
func (r *Repository) SetEntry(ctx context.Context, shortlink persistence.Shortlink) error
Click to show internal directories.
Click to hide internal directories.