Documentation
¶
Index ¶
Constants ¶
View Source
const ErrNoDatabase = "Database interface not given"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface {
Execer
Open() error
Begin() (Transaction, error)
PingContext(ctx context.Context) error
Close() error
}
Database interface of database
type Dependency ¶
Dependency interface of service
With the Run() function the service run all it's dependencies: connections to databases, another services and so on, Also there it must initialize Args.Handler, that represent runnable server object. If it returns an error, the server startup function will stop executing the steps and the program will exit with the os command.Exit(). With the Close() function, the service closes connections to other services, databases, stops running gorutins, frees resources, and so on. It also can return error, As well as Run(), Close() can return an error, which will terminate the program with an error code
type Execer ¶
type Execer interface {
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
Exec(query string, args ...interface{}) (sql.Result, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRow(query string, args ...interface{}) *sql.Row
}
type Router ¶
type Router interface {
PathHandler(tpl string, handler http.Handler) Router
PathHandlerFunc(
tpl string,
f func(http.ResponseWriter, *http.Request),
) Router
PathSubrouter(tpl string) Router
ANY(path string, f models.ResultFunc) Router
GET(path string, f models.ResultFunc) Router
POST(path string, f models.ResultFunc) Router
PUT(path string, f models.ResultFunc) Router
DELETE(path string, f models.ResultFunc) Router
OPTIONS(path string, f models.ResultFunc) Router
Router() http.Handler
}
type Server ¶
type Server interface {
Run()
AddDependencies(dependencies ...Dependency) Server
}
Server represents server interface
type Transaction ¶
Transaction interface of transaction
Click to show internal directories.
Click to hide internal directories.