incto

package module
v0.0.0-...-e85e6c6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 7 Imported by: 0

README

Incto by Fyrna

magic-based high-performance micro web framework

[!CAUTION]

DO NOT USE THIS, THIS MAGIC FROM UNHOLY BLACK MAGIC BOOK

nah, this is just PoC from my random idea that says we can use magic for web development, of course there is NO optimization and NO fully implementation for any features.

Documentation

Overview

ultra stupid web framework

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

context implementation

func (*Context) Bind

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

func (*Context) Context

func (c *Context) Context() context.Context

func (*Context) Form

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

func (*Context) Get

func (c *Context) Get(key string) any

func (*Context) HTML

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

func (*Context) Header

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

func (*Context) JSON

func (c *Context) JSON(code int, obj any) error

func (*Context) Param

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

func (*Context) Query

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

func (*Context) Request

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

func (*Context) ResponseWriter

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

func (*Context) Set

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

func (*Context) String

func (c *Context) String(code int, text string) error

type Ctx

type Ctx interface {
	// request data
	Param(key string) string
	Query(key string) string
	Form(key string) string
	Header(key string) string

	// request body
	Bind(v any) error

	// response
	String(code int, text string) error
	JSON(code int, obj any) error
	HTML(code int, html string) error

	// context
	Set(key string, value any)
	Get(key string) any
	Context() context.Context

	// internal
	Request() *http.Request
	ResponseWriter() http.ResponseWriter
}

type Experiment

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

func Experiments

func Experiments(name string) *Experiment

experiment : test your divine power

func (*Experiment) Given

func (e *Experiment) Given(conditions ...ExperimentCondition) *Experiment

what you would like to sacrifice ?

func (*Experiment) Subject

func (e *Experiment) Subject(spells ...*Spell) *Experiment

type ExperimentCondition

type ExperimentCondition interface {
	Apply(*Experiment) *Experiment
}

func PathPrefix

func PathPrefix(prefix string) ExperimentCondition

type HandlerFunc

type HandlerFunc func(Ctx) error

type Magic

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

func Cast

func Cast(spells ...*Spell) *Magic

cast function to start multiple spells

func SpellMagic

func SpellMagic() *Magic

func (*Magic) Spell

func (m *Magic) Spell(methodPath string) *Spell

func (*Magic) Start

func (m *Magic) Start(addr string) error

type MiddlewareFunc

type MiddlewareFunc func(HandlerFunc) HandlerFunc

type PathPrefixCondition

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

func (PathPrefixCondition) Apply

func (p PathPrefixCondition) Apply(exp *Experiment) *Experiment

type Route

type Route struct {
	Method      string
	Path        string
	Handler     HandlerFunc
	Middlewares []MiddlewareFunc
	// contains filtered or unexported fields
}

type Spell

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

func (*Spell) Require

func (s *Spell) Require(middleware MiddlewareFunc) *Spell

func (*Spell) With

func (s *Spell) With(handler HandlerFunc) *Spell

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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