repository

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package repository represent persistent layer with ease scalability to different repos.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// @questionID - we use quentin text here for simplicity
	GetCache(questionID, lang string) (model.Question, error)
	Put(questionID, lang string, in model.Question) error
}

For preventing translate API from overuse we should use cache. cache can be represent as well in memory object as redis implementation

type FileInterface

type FileInterface interface {
	// Require pointer for *model.QuestionList
	Read(storage interface{}) (interface{}, error)

	// No pointer for model.QuestionList
	Write(storage interface{}) error

	Close() error
}

Internal generic interface for file repository for handle and support any desired format

type Interface

type Interface interface {
	QuestionList(ctx context.Context) (model.QuestionList, error)
	AddQuestion(ctx context.Context, question model.Question) error
	Close() error
}

type Translator

type Translator interface {
	TranslateIt(ctx context.Context, lang string, uestion model.Question) (model.Question, error)
}

Directories

Path Synopsis
Package filerepo read any file slice of files in data folder file tipes could be easly adjusted
Package filerepo read any file slice of files in data folder file tipes could be easly adjusted

Jump to

Keyboard shortcuts

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