V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
Joker123456789

Beerus 发布 1.1.3

  •  
  •   Joker123456789 · Dec 20, 2021 · 2571 views
    This topic created in 1591 days ago, the information mentioned may be changed or developed.

    本来应该多积累一些 东西才发布新版的,但是我觉得 这两个功能,有和没有 的差距还是有一点点大的,会在一定程度上影响开发效率,所以就选择了赶紧发出来。

    http 请求支持同名多参数

    以前 如果一个请求中包含了 同名的多个参数,那么 beerus 只会获取一个,现在对这个功能进行了升级,可以一次性把所有同名参数都获取到。

    传统方式

    支持 urlencode 和 get 请求

    req.FormValues("name")
    

    实体接收

    支持 urlencode ,JSON 和 get 请求

    type DemoParam struct {
    
    	TestReception []string
    }
    

    DB 的条件构造器 支持多参数

    比如有这么一个条件

    where id > 10 and (name = 'bee' or age > 18)

    以前的条件构造器是不支持的,现在支持了,只需要这么写即可

    conditions := make([]*entity.Condition,0)
    conditions = append(conditions, entity.GetCondition("id > ?", 10))
    conditions = append(conditions, entity.GetCondition("and (name = ? or age > ?)", "bee", 18))// 后面可以无限追加参数,只要能跟第一个参数的里的问号对应上即可
    
    resultMap, err := operation.GetDBTemplate("Data source name").Select("table name", conditions)
    

    感兴趣的伙伴们可以访问官网,了解更多:https://beeruscc.com

    6 replies    2021-12-20 15:50:14 +08:00
    sanggao
        1
    sanggao  
       Dec 20, 2021   ❤️ 1
    没有意义的轮子
    dcoder
        2
    dcoder  
       Dec 20, 2021
    上次看见个 Go 的 micro service framework 取名叫 Kratos
    你这个取名叫 Beerus

    我也是用 Go 的, 忽然觉得这个社群有点中二, 哈哈哈
    Oktfolio
        3
    Oktfolio  
       Dec 20, 2021
    破壊神?
    Joker123456789
        4
    Joker123456789  
    OP
       Dec 20, 2021
    @Oktfolio 同道中人,居然认出了这个名字,哈哈
    limyel
        5
    limyel  
       Dec 20, 2021
    感觉这样子自己造一套轮子挺好玩的,造轮子要啥意义啊,just for fun 就行了。
    hay0577
        6
    hay0577  
       Dec 20, 2021
    @sanggao 可我连轮子都还还不会造..
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1044 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 18:46 · PVG 02:46 · LAX 11:46 · JFK 14:46
    ♥ Do have faith in what you're doing.