GithubHelp home page GithubHelp logo

axfor / bast Goto Github PK

View Code? Open in Web Editor NEW
14.0 1.0 3.0 412 KB

A lightweight RESTful framework for Go programming language

License: Apache License 2.0

Go 100.00%
go json-api golang-json-api bast restful-api lightweight graceful-restart

bast's People

Contributors

axfor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bast's Issues

kv `URL` return value is a incorrect

kv URL return value is a incorrect

        v := New()
	v["name"] = "111"
	v["age"] = 18
	v["sex"] = "girl"
	v["node"] = "bast"
	s := v.URL() 

// s value age=age&name=name&node=node&sex=sex is a incorrect
// s correct value age=18&name=111&node=bast&sex=girl

add validate to bast

add validate to bast

support struct

josn etc...

such as:

    type vv struct {
		A string  `json:"a" v:"required|min:1"`
		B *string `json:"b" v:"required|min:1"`
	}

	g := "a"
	v := vv{A: "a", B: &g}
	v2 := []vv{{A: "b", B: &g}}
	v3 := map[string]vv{"c": vv{A: "c", B: &g}}

	vr := Validator{}

	err := vr.Struct(v)
	if err != nil {
		t.Error(err)
	}

	err = vr.Struct(v2)
	if err != nil {
		t.Error(err)
	}

	err = vr.Struct(v3)
	if err != nil {
		t.Error(err)
	}

support url.Values

*http.Request etc...

such as:

    v4 := url.Values{
        "d": {
            "15",
        },
        "e": {
            "eeeee",
        },
        "f": {
            "ff",
        },
    }
    vr := Validator{}
    err := vr.Request(v4, "d@required|int|min:12|max:16", "e@required|min:5")
    if err != nil {
        t.Error(err)
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.