rest

package
v0.0.0-...-c253f3e Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHandler

func CreateHandler(s *RestApi, t interface{}) func(c *gin.Context)

func DeleteHandler

func DeleteHandler(db *gorm.DB, t interface{}) func(c *gin.Context)

func ListHandler

func ListHandler(s *RestApi, t interface{}) func(c *gin.Context)

func ParsedQuery

func ParsedQuery(c *gin.Context) (sort string, offset, limit int, filter map[string]interface{})

func ReadHandler

func ReadHandler(db *gorm.DB, t interface{}) func(c *gin.Context)

func UpdateHandler

func UpdateHandler(s *RestApi, t interface{}) func(c *gin.Context)

Types

type Client

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

func NewClient

func NewClient(baseUrl, rootPath, username, password string) *Client

func (*Client) Create

func (c *Client) Create(body interface{}) *Client

func (*Client) Delete

func (c *Client) Delete(obj interface{}) *Client

func (*Client) Do

func (c *Client) Do(f func(c *Client)) *Client

func (*Client) Error

func (c *Client) Error() error

func (*Client) Find

func (c *Client) Find(result interface{}) *Client

func (*Client) Login

func (c *Client) Login(username, password string) *Client

func (*Client) Update

func (c *Client) Update(body interface{}) *Client

func (*Client) UserName

func (c *Client) UserName() string

type CreateHandlerPreprocessor

type CreateHandlerPreprocessor interface {
	BeforeDbCreate(s *RestApi, c *gin.Context) error
}

type ErrorResult

type ErrorResult struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type K8sResource

type K8sResource interface {
	K8sCreate() error
	K8sRead() error
	K8sList(o interface{}, filter map[string]interface{}) int
	K8sDelete() error
}

type ModelContext

type ModelContext struct {
	Login bool
	User  *jwt.User
}

type RestApi

type RestApi struct {
	Login bool
	// contains filtered or unexported fields
}

func NewRestApi

func NewRestApi(t ...interface{}) *RestApi

func (*RestApi) CloseDb

func (s *RestApi) CloseDb()

func (*RestApi) Connect

func (s *RestApi) Connect(dialect, conn string) *RestApi

func (*RestApi) CreateEndpoints

func (s *RestApi) CreateEndpoints(r *gin.Engine, grp string, login bool) *RestApi

func (*RestApi) Error

func (s *RestApi) Error() error

func (*RestApi) Run

func (s *RestApi) Run() *RestApi

func (*RestApi) Server

func (s *RestApi) Server(addr string, port int, apiRoot string, login bool) *RestApi

func (*RestApi) Shutdown

func (s *RestApi) Shutdown() *RestApi

func (*RestApi) Start

func (s *RestApi) Start() *RestApi

type UpdateHandlerPreprocessor

type UpdateHandlerPreprocessor interface {
	BeforeDbUpdate(s *RestApi, c *gin.Context) error
}

Jump to

Keyboard shortcuts

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