api

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler[T any] struct {
	Method  string
	Check   func(*Server[T], *gin.Context) bool
	Handler func(*Server[T], *gin.Context)
}

メソッドとハンダラの構造体

type Page

type Page[T any] struct {
	Path     string
	Handlers []*Handler[T]

	Child []*Page[T]
}

ページの構造を表す構造体

func (*Page[T]) Parse

func (p *Page[T]) Parse(s *Server[T], g *gin.Engine)

ページ構造を解析してginエンジンに登録する

ハンダラがnilだった場合無視される

type Server

type Server[T any] struct {
	sync.Mutex

	PageTree *Page[T]
	NoRoute  []gin.HandlerFunc

	Client T
	// contains filtered or unexported fields
}

APIサーバーの構造体

func New

func New[T any](client T) *Server[T]

新たなサーバー構造を生成する

func (*Server[T]) Serve

func (s *Server[T]) Serve(addr ...string) (err error)

ページを解析してサーバーを起動する

Jump to

Keyboard shortcuts

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