sol

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 16 Imported by: 0

README

sol

Go Reference Go version GitHub license GitHub stars

A go web framework. 🌌

Install

go get -u github.com/wantnotshould/sol

Quick Start

package main

import (
	"fmt"

	"github.com/wantnotshould/sol"
)

func main() {
	sl := sol.New()

	sl.GET("/", func(c *sol.Context) {
		fmt.Fprintln(c.Writer, "Hello, world!")
	})

	sl.Run()
}

License

This project is under the MIT License. See the LICENSE file for the full license text.

Documentation

Overview

Package sol Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package sol Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package sol Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package sol Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package sol Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Package sol Copyright 2025 wantnotshould. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(r *http.Request) string

ClientIP returns the client's real IP address from the request. It considers X-Forwarded-For, X-Real-IP, and RemoteAddr headers.

Types

type Context

type Context struct {
	Request *http.Request
	Writer  http.ResponseWriter
	// contains filtered or unexported fields
}

func (*Context) Abort

func (c *Context) Abort()

Abort stops execution of remaining handlers.

func (*Context) Context

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

Context returns the request's context

func (*Context) Cookie

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

Cookie gets the value of a named cookie from the request. Returns empty string and error if not found.

func (*Context) Delete

func (c *Context) Delete(key string)

Delete removes a value from the context by its key.

func (*Context) DeleteCookie

func (c *Context) DeleteCookie(name string)

DeleteCookie removes a cookie by setting it to expired.

func (*Context) Get

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

Get retrieves a value from the request context.

func (*Context) GetString

func (c *Context) GetString(key string) (string, bool)

GetString is a convenience wrapper to retrieve and assert a string value.

func (*Context) HTML added in v0.0.3

func (c *Context) HTML(status int, html string)

func (*Context) Header

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

Header returns the value of a request header.

func (*Context) Host

func (c *Context) Host() string

Host to get the host of the request

func (*Context) IsAborted

func (c *Context) IsAborted() bool

IsAborted reports whether the handler chain has been aborted.

func (*Context) JSON added in v0.0.3

func (c *Context) JSON(status int, obj any)

func (*Context) Method

func (c *Context) Method() string

Method to get the HTTP method of the request

func (*Context) Next

func (c *Context) Next()

Next invokes the next handler in the chain.

func (*Context) Param

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

Param returns the value of a named route parameter.

func (*Context) Params

func (c *Context) Params() map[string]string

Params returns the Context params.

func (*Context) Path

func (c *Context) Path() string

Path to get the full normalized path of the request

func (*Context) QueryAll

func (c *Context) QueryAll() url.Values

QueryAll returns the full parsed query values.

func (*Context) QueryParam

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

QueryParam returns the first value for the named query parameter.

func (*Context) Scheme

func (c *Context) Scheme() string

Scheme to get the scheme of the request

func (*Context) Set

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

Set stores a value in the request context.

func (*Context) SetCookie

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

SetCookie sets a cookie in the response.

func (*Context) SetHeader

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

SetHeader sets a response header.

func (*Context) Status

func (c *Context) Status(code int)

Status sets the HTTP status code (does not write headers yet).

func (*Context) String added in v0.0.3

func (c *Context) String(status int, format string, values ...any)

func (*Context) URL

func (c *Context) URL() string

URL to get the full URL (scheme://host/path?query)

func (*Context) XML added in v0.0.3

func (c *Context) XML(status int, data map[string]string)

type HandlerFunc

type HandlerFunc func(*Context)

func Logger

func Logger() HandlerFunc

func Recover

func Recover() HandlerFunc

type Sol

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

func New

func New() *Sol

func (*Sol) Run

func (sl *Sol) Run(addr ...string)

func (*Sol) RunTLS

func (sl *Sol) RunTLS(addr, certFile, keyFile string)

func (*Sol) Stop

func (sl *Sol) Stop()

func (*Sol) WithLogger

func (sl *Sol) WithLogger() *Sol

func (*Sol) WithServer

func (sl *Sol) WithServer(server *http.Server) *Sol

Directories

Path Synopsis
Package binding Copyright 2026 wantnotshould.
Package binding Copyright 2026 wantnotshould.
Package validator Copyright 2026 wantnotshould.
Package validator Copyright 2026 wantnotshould.

Jump to

Keyboard shortcuts

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