request

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base[CType any] struct {
	Client HttpService
}

func (*Base[CType]) Create

func (b *Base[CType]) Create(item CType) (bool, *gerror.Error)

func (*Base[CType]) GetById

func (b *Base[CType]) GetById(id *primitive.ObjectID) (*CType, *gerror.Error)

func (*Base[CType]) GetDetail

func (b *Base[CType]) GetDetail(id *primitive.ObjectID) (*CType, *gerror.Error)

func (*Base[CType]) List

func (b *Base[CType]) List(filter response.ListRequest) (*response.ListResponse[CType], *gerror.Error)

func (*Base[CType]) SetField

func (b *Base[CType]) SetField(id primitive.ObjectID, key string, val any) (bool, *gerror.Error)

func (*Base[CType]) SetFields

func (b *Base[CType]) SetFields(id primitive.ObjectID, fields map[string]interface{}) (bool, *gerror.Error)

type HttpService

type HttpService struct {
	BaseUrl string
	Token   string
}

func (*HttpService) Get

func (base *HttpService) Get(path string) ([]byte, *gerror.Error)

func (*HttpService) Post

func (base *HttpService) Post(path string, body []byte) ([]byte, *gerror.Error)

func (*HttpService) Put

func (base *HttpService) Put(path string, body []byte) ([]byte, *gerror.Error)

type Interface

type Interface[CType any] interface {
	GetById(id string) (*CType, *gerror.Error)
	List(schema response.ListRequest) (*response.ListResponse[CType], *gerror.Error)
}

Jump to

Keyboard shortcuts

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