goe

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

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

Go to latest
Published: Dec 21, 2021 License: MIT Imports: 1 Imported by: 0

README

goe

Go extend.

$ go get https://github.com/elimsc/goe

chie:

var r = chi.NewRouter()
var sess sqlbuilder.Database  // see https://upper.io/db.v3

chie.CrudController

var categoryController = chie.CrudController{
    Sess:      sess,
    GetParam:  chi.URLParam,
    TableName: "category",
}

r.Route("/categories", func(r chi.Router) {
    r.Get("/", categoryController.Pagination)
    r.Get("/{id}", categoryController.One)
    r.Post("/", categoryController.Create)
    r.Put("/", categoryController.Update)
    r.Delete("/{id}", categoryController.Delete)
    r.Get("/all", categoryController.All)
})

chie.CrudTable

chie.CrudTable(r, sess, "demo", "/hi/demo")
// GET /hi/demo       list 
// POST /hi/demo      create
// GET /hi/demo/{id}  one
// PUT /hi/demo      update
// GET /hi/demo/all  all
// POST /hi/update   update

chie.CrudDb*

chie.CrudDBAll(r, sess)
chie.CrudDBOnly(r, sess, []string{"demo"})
chie.CrudDBExcept(r, sess, []string{"demo"})
// for _, table := range tables {
//    chiu.CrudTable(r, sess, table, "/"+table)
// }

chie.FileServer

workDir, _ := os.Getwd()
filesDir := filepath.Join(workDir, "files")
chie.FileServer(r, "/files", http.Dir(filesDir))

// same as
chie.ServeStatic(r, "/files", "files")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash 验证密码

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hash密码

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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