inter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 8 Imported by: 43

Documentation

Index

Constants

View Source
const (
	Short       = "short"
	Flag        = "flag"
	Description = "description"
)
View Source
const AppProvider = "app_provider"
View Source
const RequestBodyDecoder = "request_body_decoder"

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	AppReader

	// Container returns the service container
	Container() *Container

	// SetContainer set the service container
	SetContainer(container Container)

	// Singleton registered a shared binding in the container.
	Singleton(abstract interface{}, concrete interface{})

	// Bind registered an existing instance as shared in the container.
	Bind(abstract interface{}, concrete interface{})

	// Instance registered an existing instance as shared in the container without an abstract
	Instance(concrete interface{}) interface{}

	Environment() (string, error)

	IsEnvironment(environments ...string) bool

	// The Log method gives you an instance of a logger. You can write your log
	// messages to this instance.
	Log(channels ...string) LoggerFacade

	// Db returns the database facade. If no parameters are provided, it will use
	// the default connection.
	Db(connection ...string) Database
}

type AppReader

type AppReader interface {
	// MakeE the given type from the container.
	Make(abstract interface{}) interface{}

	// MakeE the given type from the container.
	MakeE(abstract interface{}) (interface{}, error)
}

type Bindings

type Bindings map[string]interface{}

type BootServiceProvider

type BootServiceProvider interface {
	Boot(container Container) Container
}

type Bootstrap

type Bootstrap interface {
	Bootstrap(app Container) Container
}

type Cache added in v0.3.0

type Cache interface {
	GetE(string) (support.Value, error)
}

type Cli added in v0.2.1

type Cli interface {
	App() App
	Writer() io.Writer
	WriterErr() io.Writer
	Ask(label string) string
	Secret(label string) string
	Confirm(label string, defaultValue bool) bool
	Choice(label string, items ...string) string
	Line(format string, arguments ...interface{})
	Comment(format string, arguments ...interface{})
	Info(format string, arguments ...interface{})
	Error(format string, arguments ...interface{})
	Table() table.Writer
}

type Command added in v0.2.0

type Command interface {
	Name() string
	Description() string
	Handle(c Cli) ExitCode
}

type Connection added in v0.3.0

type Connection interface {
	Open() error
	Pool() *sql.DB
	Timeout() time.Duration
}

type ConsoleKernel

type ConsoleKernel interface {
	Handle() ExitCode
}

type Container

type Container interface {
	AppReader

	// Register a shared binding in the container.
	Singleton(abstract interface{}, concrete interface{})

	// Register an existing instance as shared in the container with an abstract
	Bind(abstract interface{}, concrete interface{})

	// Register an existing instance as shared in the container without an abstract
	Instance(concrete interface{}) interface{}

	// GetE the container's bindings.
	Bindings() Bindings

	// Determine if the given abstract type has been bound.
	Bound(abstract string) bool

	// "Extend" an abstract type in the container.
	Extend(abstract interface{}, function func(service interface{}) interface{})
}

type Controller

type Controller = PipeHolder

type Database added in v0.3.0

type Database interface {
	Connection() Connection
	Exec(sql string, args ...interface{}) sql.Result
	ExecE(sql string, args ...interface{}) (sql.Result, error)
	Query(sql string, args ...interface{}) support.Collection
	QueryE(sql string, args ...interface{}) (support.Collection, error)
}

type Encoder

type Encoder interface {
	IsAble(object interface{}) bool
	EncodeThrough(app App, object interface{}, encoders []Encoder) (string, error)
}

type ExitCode added in v0.2.0

type ExitCode int
const (
	Success ExitCode = iota
	Failure
	Index
	Continue
)

type HttpKernel

type HttpKernel interface {
	Handle(request Request) Response
	RecoverFromMiddlewarePanic(recover interface{}) Response
}

type HttpMiddleware

type HttpMiddleware interface {
	Handle(request Request, next Next) Response
}

type JsonReader

type JsonReader interface {
	Json() interface{}
}

type Logger

type Logger interface {
	SetApp(app AppReader) Logger
	Clear() bool
	Group(group string) Logger
	Log(severity log_level.Level, message string, arguments ...interface{})
	LogWith(severity log_level.Level, message string, data interface{})
}

Logger This interface is the interface you should use to add a logger yourself.

type LoggerFacade

type LoggerFacade interface {
	SetApp(app AppReader) LoggerFacade
	Group(group string) LoggerFacade
	Log(severity log_level.Level, message string, arguments ...interface{})
	LogWith(severity log_level.Level, message string, data interface{})

	// Emergency Log that the system is unusable
	Emergency(message string, arguments ...interface{})

	// EmergencyWith Log that the system is unusable
	EmergencyWith(message string, data interface{})

	// Alert A condition that should be corrected immediately.
	Alert(message string, arguments ...interface{})

	// AlertWith A condition that should be corrected immediately.
	AlertWith(message string, data interface{})

	// Critical conditions
	Critical(message string, arguments ...interface{})

	// CriticalWith Critical conditions
	CriticalWith(message string, data interface{})

	// Error conditions
	Error(message string, arguments ...interface{})

	// ErrorWith Error conditions
	ErrorWith(message string, data interface{})

	// Warning conditions
	Warning(message string, arguments ...interface{})

	// WarningWith Warning conditions
	WarningWith(message string, data interface{})

	// Notice Normal but significant conditions
	// Conditions that are not error conditions, but that may require special handling.
	Notice(message string, arguments ...interface{})

	// NoticeWith Normal but significant conditions
	// Conditions that are not error conditions, but that may require special handling.
	NoticeWith(message string, data interface{})

	// Info Informational messages
	Info(message string, arguments ...interface{})

	// InfoWith Informational messages
	InfoWith(message string, data interface{})

	// Debug Debug-level messages
	// Messages containing information that is normally only useful when debugging a program.
	Debug(message string, arguments ...interface{})

	// DebugWith Debug-level messages
	// Messages containing information that is normally only useful when debugging a program.
	DebugWith(message string, data interface{})
}

LoggerFacade This interface ensures that the loggers can be used with the convenient leveling methods. That while the concrete logger only needs to implement inter.Logger.

type MapMethodRoutes

type MapMethodRoutes map[string][]Route

type Next

type Next = PipeHolder

type PipeHolder

type PipeHolder func(request Request) Response

type RegisterServiceProvider

type RegisterServiceProvider interface {
	Register(container Container) Container
}

type Request

type Request interface {
	App() App
	SetApp(app App)
	Make(abstract interface{}) interface{}
	MakeE(abstract interface{}) (interface{}, error)
	Body() string
	SetBody(body string) Request
	Source() http.Request
	Header(key string) string
	Headers() http.Header
	Cookie(key string) string
	CookieE(key string) (string, error)
	File(key string) support.File
	FileE(key string) (support.File, error)
	Files(key string) []support.File
	FilesE(key string) ([]support.File, error)
	Method() string
	Path() string
	Url() string
	FullUrl() string
	Content(key ...string) support.Value
	ContentE(keyInput ...string) (support.Value, error)
	ContentOr(keys string, defaultValue interface{}) support.Value
	Parameter(key string) support.Value
	ParameterE(key string) (support.Value, error)
	ParameterOr(key string, defaultValue interface{}) support.Value
	SetUrlValues(vars map[string]string) Request
	Query(key string) support.Value
	QueryE(key string) (support.Value, error)
	QueryOr(key string, defaultValue interface{}) support.Value
	Route() Route
}

type Response

type Response interface {
	App() App
	SetApp(app App)
	GetContent() interface{}
	Content(content interface{})
	GetBody() string
	GetBodyE() (string, error)
	Body(body string) Response
	GetStatus() int
	Status(status int) Response
	GetHeader(key string) string
	GetHeaders() http.Header
	Header(key string, values ...string) Response
	Headers(headers http.Header) Response
	Cookie(cookies ...http.Cookie) Response
	GetCookies() []http.Cookie
	Filename(filename string) Response
	ShowInBrowser() Response
}

type ResponseDecorator

type ResponseDecorator interface {
	Decorate(response Response) Response
}

type Route

type Route interface {
	Uri() string
	SetUri(url string) Route
	Method() string
	Controller() Controller
	SetPrefix(prefix string) Route
	SetDestination(destination string) Route
	SetStatus(status int) Route
	RouteOptions() RouteOptions
	Constraint() map[string]string
	SetConstraint(parameter string, regex string) Route
	Domain() string
	SetDomain(domain string) Route
	Name() string
	SetName(name string) Route
	Named(pattern ...string) bool
	Middleware() []HttpMiddleware
	SetMiddleware(middlewares []HttpMiddleware) Route
	SetExcludeMiddleware(middlewares []HttpMiddleware) Route
}

type RouteCollection

type RouteCollection interface {
	Push(route Route) RouteCollection
	Merge(routeCollections RouteCollection) RouteCollection
	All() []Route
	Match(request Request) Route
	Where(parameter, regex string) RouteCollection
	WhereMulti(constraints map[string]string) RouteCollection
	Domain(domain string) RouteCollection
	Prefix(prefix string) RouteCollection
	Name(name string) RouteCollection
	Middleware(...HttpMiddleware) RouteCollection
	WithoutMiddleware(...HttpMiddleware) RouteCollection
}

type RouteDecorator

type RouteDecorator interface {
	Decorate(route Route) Route
}

type RouteOptions

type RouteOptions interface {
	Prefixes() []string
	Status() int
}

type Rule

type Rule interface {
	Verify(value support.Value) error
}

type RuleWithApp

type RuleWithApp interface {
	Rule
	SetApp(app AppReader) Rule
}

type RuleWithRequirements

type RuleWithRequirements interface {
	Rule
	Requirements() []Rule
}

type TemplateBuilder

type TemplateBuilder = func(template *template.Template) (*template.Template, error)

type TypeCast added in v0.3.0

type TypeCast func(ct sql.ColumnType, raw []byte) interface{}

type View

type View interface {
	// Template returns the content of a template
	Template() string
}

Jump to

Keyboard shortcuts

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