Categorygithub.com/bytewayio/cypress
modulepackage
0.9.0
Repository: https://github.com/bytewayio/cypress.git
Documentation: pkg.go.dev

# README

cypress

An integrated web server and websocket framework

features

  1. pipeline based request handlers
  2. security as a request handler
  3. logging as a request handler
  4. MVC support
  5. Redis based session store support
  6. context for all, supports cancellation and correlation logging

build

go get github.com/bytewayio/grab grab go build

# Functions

Aes256Decrypt decrypts the data with given key and iv using AES256/CBC/PKCS5Padding.
Aes256Encrypt encrypts the data with given key and iv using AES256/CBC/PKCS5Padding.
AsController enumerates all accessible member functions of c which has two parameters and *http.Request as the first one while *Response as the second one as Actions.
GetFieldValueGetters gets all possible FieldValueGetters for the give type t.
GetSession helper function for getting session from request.
GetTraceID get the trace ID related to the context.
GetUser gets the UserPrincipal for the request.
LogExec log the sql Exec call result.
LoggingHandler http incoming logging handler.
Md5 returns the md5 checksum of the data.
NewBufferWriter creates a new buffer based writer.
NewConcurrentMap creates a new instance of ConcurrentMap.
NewConcurrentMapTypeEnforced create a new instance of ConcurrentMap with enforcement of the value type.
NewFieldValueGetter creates a new FieldValueGetter object.
NewFileSessionStore creates a file session store.
NewInMemorySessionStore creates an in memory session store.
NewRedisSessionStore creates a new redis based session store.
NewRollingLogWriter returns a new file based rolling log writer maxSizeInMegaBytes specifies the maximum size of each log file, while maxRotationFiles tells the maximum files to keep.
NewSecurityHandler creates an instance of SecurityHandler object without any user providers and with nil AuthorizationManager.
NewSession creates a new session.
NewSessionHandler creates a new session handler with registering the session object types.
NewSessionID creates a new session ID.
NewSkinManager creates a skin manager object.
NewSmartMapper creates a smart row mapper for data row.
NewTemplateManager creates a template manager for the given dir.
NewWebServer creates a web server instance to listen on the specified address.
QueryAll query all rows and map them to objects.
QueryOne query one object.
SendError complete the request by sending an error message to the client.
SetupLogger setup the global logger with specified log writer and log level this must be called before the logging can actually work.
Sha1 returns the sha1 checksum of the data.
Sha256 returns the sha256 checksum of the data.

# Constants

LogLevelDebug debug logging level.
LogLevelError error level.
LogLevelInfo info logging level.
LogLevelWarn warnning level.
TraceActivityIDKey context key for trace activity id.
TraceActivityIDKey context key for trace activity id.
TraceActivityIDKey context key for trace activity id.

# Variables

CaptchaKey captcha key in session.
CaptchaSessionKey captcha alternative session key parameter name.
CorrelationIDHeader http header name for correlation id header.
ErrBadSessionFile failed to read session data from session file.
ErrDirectoryRequired a directory is expected but file is seen.
ErrDupActionName mulitple actions are having the same name for the same controller.
ErrFileRequired a file is expected but directory is seen.
ErrNoFile no file given for Creating a template.
ErrPointerRequired a pointer is required.
ErrSessionNotFound a session with the specified key cannot be found.
NotFoundMsg message to be shown when resource not found.
ServerName name of the app.
ServerVersion version of the server.
SkinDefault default skin name.

# Structs

Action a named http.Handler.
BufferedWriter writes everything into memory.
ConcurrentMap a concurrent map.
DummyWriter drops all data to be written.
FieldValueGetter the field value pointer retriever.
Response web response.
SecurityHandler a http handler to do both authentication and authorization for requests.
Session a HTTP session.
SkinManager a TemplateManager is mapped to a skin, skin manager manages TemplateManagers by names.
TemplateManager manages the templates by groups and update template group on-demand based on the template file update timestamp.
UserPrincipal the security principal of the http session.
WebServer a web server that supports auth & authz, logging, session and web sockets.
WebSocketHandler Web socket handler have handler.Handle for router to enable web socket endpoints.
WebSocketSession a connected web socket session.

# Interfaces

AuthorizationManager an interface used by the security handler to check if the given user has permission to use the specified method and access the given path.
Controller a request controller that could provide a set of http.Handler to handle http requests based on the action name.
CustomHandler a handler that is executed after session is setup/restored.
DataRow data row, which can be used to scan values or get column information.
Queryable a queryable object that could be a Connection, DB or Tx.
RowMapper maps a row to an object.
SessionStore interface for storing sessions.
SkinSelector returns a skin name based on the request object.
UserProvider an interface used by the framework to resolve UserPrincipal from incoming request and also used by loading the UserPrincipal in authorized mode by given user id and user domain.
WebSocketListener web socket listener that could be used to listen on a specific web socket endpoint.

# Type aliases

ActionHandler action handler for standard routing.
ControllerFunc a function that implements Controller interface.
CustomHandlerFunc a function that implements CustomHandler.
LogLevel logging level.
RowMapperFunc a function that implements RowMapper.
SharedTemplateDetector detector used to check if the given path is a shared template or not.
SkinSelectorFunc converts a function to SkinSelector interface.
TemplateConfigFunc shared templates config function.