repositorys

package
v0.0.0-...-c1860e7 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConnection

func CloseConnection(repo *MongoRepository) error

CloseConnection shut down the connection

Types

type MongoRepository

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

MongoRepository inherited from Repository

func Connect

func Connect() (MongoRepository, error)

Connect to the Mongo DB

func NewMongoRepository

func NewMongoRepository() MongoRepository

NewMongoRepository Create a new Repository for MongoDB

func (*MongoRepository) CreateFile

func (repo *MongoRepository) CreateFile(file dataclasses.Textfile) (int, error)

CreateFile create a new document on the database

func (*MongoRepository) DeleteFile

func (repo *MongoRepository) DeleteFile(id int) (bool, error)

DeleteFile remove a textfile from the database

func (*MongoRepository) GetCollection

func (repo *MongoRepository) GetCollection(database string) ([]string, error)

GetCollection return all collections of a Database

func (*MongoRepository) GetDataBaseList

func (repo *MongoRepository) GetDataBaseList() ([]string, error)

GetDataBaseList returns a List of Databases

func (*MongoRepository) GetFile

func (repo *MongoRepository) GetFile(id int) (dataclasses.Textfile, error)

GetFile return a textfile from the database specified by the documentid

func (*MongoRepository) SetDatabase

func (repo *MongoRepository) SetDatabase(databasedata dataclasses.Connection) error

SetDatabase set the connections values for operation on the mongodb

func (*MongoRepository) UpdateFile

func (repo *MongoRepository) UpdateFile(file dataclasses.Textfile) (dataclasses.Textfile, error)

UpdateFile update a recent file on the database

type Repository

type Repository interface {
	CreateFile(dataclasses.Textfile) (int, error)
	GetDataBaseList() ([]string, error)
	GetCollection(string) ([]string, error)
	SetDatabase(dataclasses.Connection) error
	GetFile(int) (dataclasses.Textfile, error)
	UpdateFile(dataclasses.Textfile) (dataclasses.Textfile, error)
	DeleteFile(int) (bool, error)
}

Repository Abstract Interface

type SQLLiteRepository

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

SQLLiteRepository inherited from Repository

func ConnectSQLLite

func ConnectSQLLite() (SQLLiteRepository, error)

ConnectSQLLite handles connect to database

func NewSQLLiteRepository

func NewSQLLiteRepository() SQLLiteRepository

NewSQLLiteRepository create new repository

func (*SQLLiteRepository) CloseConnection

func (repo *SQLLiteRepository) CloseConnection() error

CloseConnection shut down the connection

func (*SQLLiteRepository) CreateFile

func (repo *SQLLiteRepository) CreateFile(file dataclasses.Textfile) (int, error)

CreateFile create a new document on the database

func (*SQLLiteRepository) DeleteFile

func (repo *SQLLiteRepository) DeleteFile(id int) (bool, error)

DeleteFile remove a textfile from the database

func (*SQLLiteRepository) GetCollection

func (repo *SQLLiteRepository) GetCollection(database string) ([]string, error)

GetCollection return all collections of a Database

func (*SQLLiteRepository) GetDataBaseList

func (repo *SQLLiteRepository) GetDataBaseList() ([]string, error)

GetDataBaseList returns a List of Databases

func (*SQLLiteRepository) GetFile

func (repo *SQLLiteRepository) GetFile(id int) (dataclasses.Textfile, error)

GetFile return a textfile from the database specified by the documentid

func (*SQLLiteRepository) SetDatabase

func (repo *SQLLiteRepository) SetDatabase(databasedata dataclasses.Connection) error

SetDatabase set the connections values for operation on the mongodb

func (*SQLLiteRepository) UpdateFile

func (repo *SQLLiteRepository) UpdateFile(file dataclasses.Textfile) (dataclasses.Textfile, error)

UpdateFile update a recent file on the database

Jump to

Keyboard shortcuts

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