store

package
v0.0.0-...-f113005 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shortener

type Shortener interface {
	Get(id string) (entities.Shorten, error)
	Insert(srt entities.Shorten) error
	Update(srt entities.Shorten) error
}

Shortener is interface for methods the store package.

type StoreMongodb

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

StoreMongodb is struct for db mongodb

func NewStoreMongodb

func NewStoreMongodb() *StoreMongodb

NewStoreMongodb return instance the StoreMongodb

func (*StoreMongodb) Disconnect

func (sm *StoreMongodb) Disconnect() error

Disconnect execute disconnect for database.

func (*StoreMongodb) Get

func (sm *StoreMongodb) Get(id string) (entities.Shorten, error)

Get return first Shorten from database

func (*StoreMongodb) Insert

func (sm *StoreMongodb) Insert(srt entities.Shorten) error

Insert add new Shorten to database

func (*StoreMongodb) Ping

func (sm *StoreMongodb) Ping() error

Ping execute test of connection in database.

func (*StoreMongodb) Update

func (sm *StoreMongodb) Update(srt entities.Shorten) error

Update change the shorten and save in database.

type StoreSqlite

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

StoreSqlite is struct for db sqlite.

func NewStoreSqlite

func NewStoreSqlite() *StoreSqlite

NewStoreSqlite return instance the StoreSqlite.

func (*StoreSqlite) Get

func (s *StoreSqlite) Get(id string) (entities.Shorten, error)

Get return first Shorten from database.

func (*StoreSqlite) Insert

func (s *StoreSqlite) Insert(srt entities.Shorten) error

Insert add new Shorten to database.

func (*StoreSqlite) Update

func (s *StoreSqlite) Update(srt entities.Shorten) error

Update change the shorten and save in database.

Jump to

Keyboard shortcuts

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