application

package
v0.0.0-...-b2170da Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App is used to contains all services together and control their life

func NewApp

func NewApp(config Config) *App

NewApp creates new App

func (*App) BrainList

func (app *App) BrainList() ([]BrainInterface, error)

func (*App) CreateBrain

func (app *App) CreateBrain(name string, description string) (BrainInterface, error)

func (*App) DeleteBrain

func (app *App) DeleteBrain(id int64) error

func (*App) Destroy

func (app *App) Destroy()

Destroy closes all connections

func (*App) GetBrainByReference

func (app *App) GetBrainByReference(reference string) (BrainInterface, error)

func (*App) GetClassByID

func (app *App) GetClassByID(classID int64) (entity.ClassInterface, error)

func (*App) HumanizedPredict

func (app *App) HumanizedPredict(brainID int64, text string) (entity.HumanizedPrediction, error)

func (*App) Init

func (app *App) Init()

Init runs initialization for all application components. Requires database and other external services are available.

func (*App) Migrate

func (app *App) Migrate()

Migrate applies migrations

func (*App) Predict

func (app *App) Predict(brainID int64, text string) (prediction entity.Prediction, err error)

func (*App) Train

func (app *App) Train(brainID int64, samples []entity.Sample) error

Train implements AppInterface and allows to train brains

type Config

type Config struct {
	Log struct {
		Level  string
		Format string
	}
	Database struct {
		URL               string
		ConnectionTimeout time.Duration
		Automigrate       bool
		MigrationsPath    string
	}
}

Config contains a configuration which is required for Apps

Jump to

Keyboard shortcuts

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