dart

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudContext

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

func (*CloudContext) Database

func (c *CloudContext) Database() (*Database, error)

func (*CloudContext) Delete

func (c *CloudContext) Delete(key string)

func (*CloudContext) Get

func (c *CloudContext) Get(key string) (any, bool)

func (*CloudContext) Set

func (c *CloudContext) Set(key string, value any)

func (*CloudContext) WebsocketManager

func (c *CloudContext) WebsocketManager() (*WebsocketManager, error)

type CloudFunction

type CloudFunction struct {
	Name    string
	EntryID cron.EntryID
	Handler CloudHandler
}

type CloudHandler

type CloudHandler func(ctx *CloudContext) error

type Context

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

func (*Context) Bytes

func (c *Context) Bytes(statusCode int, data []byte, contentType string) error

func (*Context) ClientIP

func (c *Context) ClientIP() string

func (*Context) Cookie

func (c *Context) Cookie(name string) (*http.Cookie, error)

func (*Context) DB

func (c *Context) DB() (*Database, error)

func (*Context) File

func (c *Context) File(filePath string) error

func (*Context) FormFile

func (c *Context) FormFile(field string) (multipart.File, error)

func (*Context) HTML

func (c *Context) HTML(statusCode int, html string) error

func (*Context) Header

func (c *Context) Header(key string) string

func (*Context) JSON

func (c *Context) JSON(statusCode int, v any) error

func (*Context) Param

func (c *Context) Param(key string) string

func (*Context) ParseForm

func (c *Context) ParseForm(v any) error

func (*Context) ParseJSON

func (c *Context) ParseJSON(v any) error

func (*Context) ParseMultipartForm

func (c *Context) ParseMultipartForm(v any, maxMemory int64) error

func (*Context) ParseQuery

func (c *Context) ParseQuery(v any) error

func (*Context) ParseXML

func (c *Context) ParseXML(v any) error

func (*Context) Query

func (c *Context) Query(key string) string

func (*Context) Redirect

func (c *Context) Redirect(statusCode int, url string) error

func (*Context) Request

func (c *Context) Request() *http.Request

func (*Context) Response

func (c *Context) Response() http.ResponseWriter

func (*Context) SetCookie

func (c *Context) SetCookie(cookie *http.Cookie)

func (*Context) SetHeader

func (c *Context) SetHeader(key, value string)

func (*Context) SetValue

func (c *Context) SetValue(key ContextKey, value any)

func (*Context) Status

func (c *Context) Status(statusCode int)

func (*Context) Text

func (c *Context) Text(statusCode int, message string) error

func (*Context) UserAgent

func (c *Context) UserAgent() string

func (*Context) Value

func (c *Context) Value(key ContextKey) any

func (*Context) WebsocketManager

func (c *Context) WebsocketManager() (*WebsocketManager, error)

type ContextKey

type ContextKey string

type Dart

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

func New

func New() *Dart

func (*Dart) DB

func (d *Dart) DB() (*Database, error)

func (*Dart) DELETE

func (d *Dart) DELETE(path string, h Handler, middlewares ...Middleware)

func (*Dart) GET

func (d *Dart) GET(path string, h Handler, middlewares ...Middleware)

func (*Dart) Group

func (d *Dart) Group(prefix string) *Group

func (*Dart) HEAD

func (d *Dart) HEAD(path string, h Handler, middlewares ...Middleware)

func (*Dart) OPTIONS

func (d *Dart) OPTIONS(path string, h Handler, middlewares ...Middleware)

func (*Dart) PATCH

func (d *Dart) PATCH(path string, h Handler, middlewares ...Middleware)

func (*Dart) POST

func (d *Dart) POST(path string, h Handler, middlewares ...Middleware)

func (*Dart) PUT

func (d *Dart) PUT(path string, h Handler, middlewares ...Middleware)

func (*Dart) ScheduleCloudFunction

func (d *Dart) ScheduleCloudFunction(spec string, cf *CloudFunction)

func (*Dart) SetErrorHandler

func (d *Dart) SetErrorHandler(errorHandler ErrorHandler)

func (*Dart) Start

func (d *Dart) Start(listenAddr string) error

func (*Dart) StartTLS

func (d *Dart) StartTLS(listenAddr, certFile, keyFile string) error

func (*Dart) Static

func (d *Dart) Static(prefix, root string, middlewares ...Middleware)

func (*Dart) Use

func (d *Dart) Use(middlewares ...Middleware)

func (*Dart) Websocket

func (d *Dart) Websocket(path string, middlewares ...Middleware)

func (*Dart) WithCloudFunctions

func (d *Dart) WithCloudFunctions()

func (*Dart) WithMySQLDatabase

func (d *Dart) WithMySQLDatabase(cfg MySQLConfig)

func (*Dart) WithPostgreSQLDatabase

func (d *Dart) WithPostgreSQLDatabase(cfg PostgreSQLConfig)

func (*Dart) WithSQLiteDatabase

func (d *Dart) WithSQLiteDatabase(cfg SQLiteConfig)

func (*Dart) WithWebsocketManager

func (d *Dart) WithWebsocketManager()

type Database

type Database struct {
	Conn *gorm.DB
}

func NewMySQLDatabase

func NewMySQLDatabase(cfg MySQLConfig) *Database

func NewPostgreSQLDatabase

func NewPostgreSQLDatabase(cfg PostgreSQLConfig) *Database

func NewSQLiteDatabase

func NewSQLiteDatabase(cfg SQLiteConfig) *Database

type ErrorHandler

type ErrorHandler func(err error, ctx *Context)

type Group

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

func (*Group) DELETE

func (g *Group) DELETE(path string, h Handler, middlewares ...Middleware)

func (*Group) GET

func (g *Group) GET(path string, h Handler, middlewares ...Middleware)

func (*Group) Group

func (g *Group) Group(prefix string) *Group

func (*Group) HEAD

func (g *Group) HEAD(path string, h Handler, middlewares ...Middleware)

func (*Group) OPTIONS

func (g *Group) OPTIONS(path string, h Handler, middlewares ...Middleware)

func (*Group) PATCH

func (g *Group) PATCH(path string, h Handler, middlewares ...Middleware)

func (*Group) POST

func (g *Group) POST(path string, h Handler, middlewares ...Middleware)

func (*Group) PUT

func (g *Group) PUT(path string, h Handler, middlewares ...Middleware)

func (*Group) Static

func (g *Group) Static(prefix, root string, middlewares ...Middleware)

func (*Group) Use

func (g *Group) Use(middlewares ...Middleware)

type Handler

type Handler func(ctx *Context) error

type Json

type Json map[string]any

type Middleware

type Middleware func(next Handler) Handler

type MySQLConfig

type MySQLConfig struct {
	Username string
	Password string
	Host     string
	Port     string
	Database string
}

type PostgreSQLConfig

type PostgreSQLConfig struct {
	Username string
	Password string
	Host     string
	Port     string
	Database string
}

type SQLiteConfig

type SQLiteConfig struct {
	Filename string
}

type WebsocketManager

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

func (*WebsocketManager) Broadcast

func (wm *WebsocketManager) Broadcast(path string, msg []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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