core

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

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 16 Imported by: 4

README

core

core package with main App type

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TokenSigningKey []byte

Functions

This section is empty.

Types

type App

type App struct {
	DB     *gorm.DB
	R      *mux.Router
	Mail   mailHelper.Mailer
	Config Config
	IsTest bool
}

func (*App) CheckToken

func (a *App) CheckToken(tokenString string) (jwt.Claims, error)

func (*App) GenToken

func (a *App) GenToken(id, login, role *string, status *string) (string, error)

func (*App) Init

func (a *App) Init()

func (*App) Protect

func (a *App) Protect(next func(w http.ResponseWriter, r *http.Request), roles []string) func(w http.ResponseWriter, r *http.Request)

func (*App) Run

func (a *App) Run(addrs string)

func (*App) ToSum256

func (a *App) ToSum256(s string) string

type Config

type Config struct {
	Dbtype          string
	Dbhost          string
	Dbname          string
	Dbuser          string
	Dbpass          string
	TokenSigningKey string
	MailLogin       string
	MailPassword    string
	MailServer      string
	MailPort        string
	UploadsPath     string
	WebRootPath     string
}

type ErrorMsg

type ErrorMsg struct {
	Item string `json:"item"`
	Msg  string `json:"msg"`
}

type Errs

type Errs []ErrorMsg

func (*Errs) Add

func (e *Errs) Add(item string, msg string)

type Response

type Response struct {
	Errors Errs          `json:"errors"`
	Data   interface{}   `json:"data"`
	Count  int64         `json:"count"`
	Req    *http.Request `json:"-"`
}

func (*Response) IsJsonParseDone

func (r *Response) IsJsonParseDone(jsn io.Reader) bool

func (*Response) IsValidate

func (r *Response) IsValidate() bool

func (*Response) Make

func (r *Response) Make() []byte

Jump to

Keyboard shortcuts

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