GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.

Overview

GoFrame

Go Doc Build Status Go Report Code Coverage Production Ready License

English | 简体中文

GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.

If you're a newbie to Go, you may consider GoFrame easy and great as Laravel in PHP, SpringBoot in Java or Django in Python.

Installation

go get -u -v github.com/gogf/gf

suggested using go.mod:

require github.com/gogf/gf latest

Limitation

golang version >= 1.11

Architecture

Packages

  1. Primary Package

    The gf repository maintains some basic and most commonly used packages, keeping it as lightweight and simple as possible.

  2. Community Package

    The community packages are contributed and maintained by community members, which are hosted in gogf organization. Some of the community packages are separated from the gf repository, which are not of common usage or are with heavy dependencies.

Performance

The Web component performance of GoFrame, please refer to third-party project: https://github.com/the-benchmarker/web-frameworks

Documentation

Discussion

It's recommended learning GoFrame through its awesome source codes and API reference.

License

GF is licensed under the MIT License, 100% free and open-source, forever.

Part Of Users

We list part of the users here, if your company or products are using GoFrame, please let us know here.

Contributors

This project exists thanks to all the people who contribute. [Contributors].

Donators

If you love GF, why not buy developer a cup of coffee?

Sponsors

We appreciate any kind of sponsorship for GF development. If you've got some interesting, please contact WeChat 389961817 / Email [email protected].

Thanks

JetBrains Atlassian

Comments
  • 性能问题

    性能问题

    被gf的路由注册、数据库record、自带很多常用的工具集等特点吸引过来,确实方便,花了几天时间打磨出一套快速开发平台,包括权限系统、代码生成的功能,目前也有几个系统在此平台运行。 由于系统涉及到高并发大流量的场景,我做了很多的压测,发现内存不断的增加,3种注册方式都测试过,函数注册、对象注册、控制器注册都试过,甚至函数注册逻辑只渲染一个简单的模板页面,最终结果都会导致内存不断增加,增加到2G之后我就没再做测试,等了数个小时之后,内存才降到200多M。 周末在家,我用gin实现了同样的功能,包括模板输出和json输出,在高并发的情况下,内存稳定在36M。 当然,gin用起来确实没有gf爽快,我希望作者给出内存不断增长的原因。

    bug enhancement 
    opened by piaohao 16
  • [P0]两点建议,大大有空看到请回复下

    [P0]两点建议,大大有空看到请回复下

    1.关于g.Db,当sql的debug开启时会输出一条条sql日志,目前是这样的

    [ 12 ms] [default] SHOW FULL COLUMNS FROM `users_source 
    

    希望能在链式操作上开放一个接口手动设置一个unique.让其输出变成

    [ 12 ms] [uniquestr] SHOW FULL COLUMNS FROM `users_source` 
    //伪代码:
    db.Table(table).SetUniqueStr(guid.S()).One()
    

    基本每次http请求都会对上下文设置一个workid,让sql日志也实现关联. 2.关于gvalidate.go语言的特性会对数值类型自动设置默认值0,直接导致了required的验证失效,对于数值类型的required验证希望能做成对入参的has+empty+类型验证.例如对如下的money字段验证

    例1:?money=1&uid=1//`p:"money" v:"required " 通过
    例2:?uid=1//`p:"money" v:"required " 不通过
    例3:?money=&uid=1//`p:"money" v:"required " 不通过
    
    done feature 
    opened by LonelySally 15
  • 2.1版本gf build命令没有进行pack打包

    2.1版本gf build命令没有进行pack打包

    2.1版本gf build命令没有进行pack打包

    (1)gf build没有自动执行pack (2)手动pack文件到internal/packed/data.go,然后执行gf build,将编译后的可执行文件在同环境的新设备运行,结果无法运行,原因是manifest和resource的文件找不到。

    config.yaml配置如下

    gfcli:
      build:
        name: "gfCms"
        arch: "amd64"
        system: "linux"
        mod: "none"
        cgo: 0
        pack: "manifest/config,manifest/i18n,resource/public,resource/template"
        version: ""
        output: "./bin"
        extra: ""
    
    enhancement done question 
    opened by demozx 13
  • How to develop the doquery method in callback processing on the ORM interface to obtain the request header information of the current request

    How to develop the doquery method in callback processing on the ORM interface to obtain the request header information of the current request

    1. What version of Go and system type/arch are you using?

    go1.16

    2. What version of GoFrame are you using?

    goframe1.16.*

    3. Can this issue be re-produced with the latest release?

    no

    4. What did you do?

    func (d *MyDriver) DoQuery(ctx context.Context, link gdb.Link, sql string, args ...interface{}) (rows *sql.Rows, err error) { r.GetParam("") }

    5. What did you expect to see?

    I want to get the information in the request header of the current request in the callback processing doquery method developed by the ORM interface, because I need to get the tenant in the current request header and then dynamically splice the SQL

    6. What did you see instead?

    opened by FTLLOVE 12
  • session强制缓存到内存的问题

    session强制缓存到内存的问题

    最近新上服务时发现服务内存使用过多,所以开启了pprof定位,最后定位到是使用了session的问题,从源码可以看到,每次请求结束关闭session时都会把当前session刷进内存且在内存存活的时间与session stroge一致,这样就会导致session的数据会存在两份,一份在远端存储,一份为本地内存。当请求用户基数较大时程序会占用非常大的内存且很久都无法释放 https://github.com/gogf/gf/blob/be77779affcc6b58d9841001c128956aeac750bc/os/gsession/gsession_session.go#L106

    我理解这样设计的原因是当远端session存储不可用时,可以有内存session进行兜底。 但我觉得至少也需要有方法可以限制session使用的内存,遗憾的是目前并没有发现有提供这样的方法 https://github.com/gogf/gf/blob/be77779affcc6b58d9841001c128956aeac750bc/os/gsession/gsession_manager.go#L33

    希望可以在实例化SessionManager的时候设置sessionDatalruCap大小;或者提供可选项,由开发者选择是否使用本地内存缓存session

    enhancement done 
    opened by zhoxife3ng 12
  • gconv 转换碰到问题

    gconv 转换碰到问题

    1. What version of Go and system type/arch are you using?

    go version go1.13.4 windows/amd64

    2. What version of GoFrame are you using?

    v1.13.2-0.20200701150539-76d93b3a6124

    3. Can this issue be reproduced with the latest release?

    yes

    4. What did you do?

    
    type Sub2 struct {
    	SubName string
    }
    
    type sub1 struct {
    	Sub2
    	Name string
    }
    type Test struct {
    	Sub sub1 `json:"sub"`
    }
    
    func Test_Conv(t *testing.T) {
    	data := `{
        "sub": {
            "Name": "name",
            "SubName": "subname"
        }}`
    	vdata := Test{
    		Sub: sub1{
    			Name: "name",
    			Sub2: Sub2{
    				SubName: "subname",
    			},
    		},
    	}
    	t.Run("gjson.Decode", func(t *testing.T) {
    		tx := Test{}
    		err := gjson.DecodeTo(data, &tx)
    		if err != nil {
    			t.Fatal(err)
    		}
    		gtest.AssertEQ(tx, vdata)
    	})
    	t.Run("gconv.StructDeep", func(t *testing.T) {
    		tx := Test{}
    		err := gconv.StructDeep(data, &tx)
    		if err != nil {
    			t.Fatal(err)
    		}
    		gtest.AssertEQ(tx, vdata)
    	})
    }
    

    如上测试代码

    使用gjson直接转换正常,改成使用gconv转换出来的结果不符合预期?不知是我的使用问题还是BUG?

    原始的使用场景是从配置文件直接转换成所需要的数据格式.发现异常

    g.Cfg().GetStructDeep(name,Point)
    

    目前我的解决方法

    gjson.DecodeTo(g.Cfg().GetString(name), Point)
    

    5. What did you expect to see?

    {"sub":{"SubName":"subname","Name":"name"}}
    

    6. What did you see instead?

    {"sub":{"SubName":"","Name":"name"}}
    
    bug enhancement done 
    opened by chenall 12
  • 中间件的执行逻辑问题

    中间件的执行逻辑问题

    使用的v1.9.10的GF,现有如下代码:

    package main
    
    import (
    	"fmt"
    	"net/http"
    
    	"github.com/gogf/gf/frame/g"
    	"github.com/gogf/gf/net/ghttp"
    )
    
    func MiddlewareAuth1(r *ghttp.Request) {
    	fmt.Println("middleware 1")
    	token := r.Get("token")
    	if token == "123456" {
    		r.Middleware.Next()
    	} else {
    		r.Response.WriteStatus(http.StatusForbidden)
    	}
    }
    func MiddlewareAuth2(r *ghttp.Request) {
    	fmt.Println("middleware 2")
    	token := r.Get("token")
    	if token == "123456" {
    		r.Middleware.Next()
    	} else {
    		r.Response.WriteStatus(http.StatusForbidden)
    	}
    }
    
    func MiddlewareFree(r *ghttp.Request) {
    	fmt.Println("middleware free")
    	r.Response.CORSDefault()
    	r.Middleware.Next()
    }
    func MiddlewareCORS(r *ghttp.Request) {
    	fmt.Println("middleware CORS")
    	r.Response.CORSDefault()
    	r.Middleware.Next()
    }
    
    func main() {
    	s := g.Server()
    	s.Group("/", func(g *ghttp.RouterGroup) {
    		g.MiddlewarePattern("/*", func(r *ghttp.Request) {
    			if r.URL.Path == "/login" {
    				r.Middleware.Next()
    				return
    			}
    			MiddlewareAuth1(r)
    			MiddlewareAuth2(r)
    		})
    	})
    	s.Group("/", func(g *ghttp.RouterGroup) {
    		g.ALL("/login", func(r *ghttp.Request) {
    			r.Response.Write("login")
    		})
    		g.ALL("/dashboard", func(r *ghttp.Request) {
    			r.Response.Write("dashboard")
    		})
    	})
    	s.Group("/api.v2", func(g *ghttp.RouterGroup) {
    		g.Middleware(MiddlewareFree, MiddlewareCORS)
    		g.ALL("/user/list", func(r *ghttp.Request) {
    			r.Response.Write("list")
    		})
    	})
    	s.SetPort(8199)
    	s.Run()
    }
    

    当我请求localhost:8199/api.v2/user/list的时候,的确应该返回403,但是问题是我收到了两个403,响应是这样的:ForbiddenForbidden。我的理解应该是:前一个中间件已经返回403了,不是200了,后面的中间件是不是不要再执行了?或者要其他什么手段控制它是否执行? 如果我把代码改成这样:

    package main
    
    import (
    	"fmt"
    	"net/http"
    
    	"github.com/gogf/gf/frame/g"
    	"github.com/gogf/gf/net/ghttp"
    )
    
    func MiddlewareAuth1(r *ghttp.Request) {
    	fmt.Println("middleware 1")
    	token := r.Get("token")
    	if token == "123456" {
    		r.Middleware.Next()
    	} else {
    		r.Response.WriteStatus(http.StatusForbidden)
    	}
    }
    func MiddlewareAuth2(r *ghttp.Request) {
    	fmt.Println("middleware 2")
    	token := r.Get("token")
    	if token == "123456" {
    		r.Middleware.Next()
    	} else {
    		r.Response.WriteStatus(http.StatusForbidden)
    	}
    }
    
    func MiddlewareFree(r *ghttp.Request) {
    	fmt.Println("middleware free")
    	r.Response.CORSDefault()
    	r.Middleware.Next()
    }
    func MiddlewareCORS(r *ghttp.Request) {
    	fmt.Println("middleware CORS")
    	r.Response.CORSDefault()
    	r.Middleware.Next()
    }
    
    func main() {
    	s := g.Server()
    	s.Group("/", func(g *ghttp.RouterGroup) {
    		g.Middleware(MiddlewareAuth1, MiddlewareAuth2)
    		g.MiddlewarePattern("/*", func(r *ghttp.Request) {
    			if r.URL.Path == "/login" {
    				r.Middleware.Next()
    				return
    			}
    		})
    	})
    	s.Group("/", func(g *ghttp.RouterGroup) {
    		g.ALL("/login", func(r *ghttp.Request) {
    			r.Response.Write("login")
    		})
    		g.ALL("/dashboard", func(r *ghttp.Request) {
    			r.Response.Write("dashboard")
    		})
    	})
    	s.Group("/api.v2", func(g *ghttp.RouterGroup) {
    		g.Middleware(MiddlewareFree, MiddlewareCORS)
    		g.ALL("/user/list", func(r *ghttp.Request) {
    			r.Response.Write("list")
    		})
    	})
    	s.SetPort(8199)
    	s.Run()
    }
    

    注意第44行,是我的改动,此时再请求localhost:8199/api.v2/user/list,只会返回1个403,一个Forbidden,然而,新的问题来了,不能正常访问login接口了。

    总结一下:

    1. 如果使用MiddlewarePattern绑定中间件,前一个403了之后,后一个还会执行,是否bug?
    2. 如果使用RouterGroup绑定中间件,官方文档中的例外控制action就失效了,是否bug?
    enhancement question 
    opened by ccpwcn 12
  • CPU 占用居高不下

    CPU 占用居高不下

    Build Detail: Go Version: go1.13.4 GF Version: v1.13.1 Git Commit: 1db1828b35c15b4a92cd144c33e636eb52d7ec07 Build Time: 2020-06-14 21:01:20

    今日进行代码漏洞扫描,指标如下:

    2个并发请求
    250ms请求延迟
    

    1、持续5分钟后,系统4核CPU全部占满, 2、7分钟后,应用服务响应变慢, 3、扫描结束30分钟后,CPU资源仍未释放

    20201119163428

    profile001

    enhancement done 
    opened by mir355 11
  • Cannot upload file on Linux

    Cannot upload file on Linux

    1. What version of Go and system type/arch are you using?

    go version go1.14.3 linux/amd64

    2. What version of GoFrame are you using?

    v1.12.3

    3. Can this issue be reproduced with the latest release?

    Yes

    4. What did you do?

    Use ghttp client to upload file ghttp.post, although it can be uploaded normally on Windows, it cannot be uploaded on Linux no matter using relative path or absolute path. The file is saved through files.save

    5. What did you expect to see?

    Normal uploads are also available on Linux

    6. What did you see instead?

    Normal uploads are also available on Linux

    question 
    opened by mingzaily 11
  • gqueue性能问题咨询

    gqueue性能问题咨询

    最近在使用gf的gqueue的时候,使用日志打点发现gqueue的性能似乎不太稳定,在我理解应该都是毫秒以下的处理,但是实际抖动延时很大,最大的时候达到了140ms,具体如下图描述,是否在使用上存在有什么不对的地方么。 golang 版本 go version go1.11.4 GOOS=linux AMD64 gf 版本 v1.6.17

    TIM截图20190616163435

    enhancement done 
    opened by foxhack 11
  • 2.0.6版本自带的swagger不能被其他IP访问

    2.0.6版本自带的swagger不能被其他IP访问

    使用2.0.6版本并配置了swagger,本地打开正常,本地其他ip打开不了,后端显示200

    配置文件 server: address: ":8201" serverRoot: "resource/public" dumpRouterMap: true routeOverWrite: true openapiPath: "/api.json" swaggerPath: "/swagger" NameToUriType: 3 maxHeaderBytes: "20KB" clientMaxBodySize: "50MB"

    Logging配置

    logPath: "resource/log/server" # 日志文件存储目录路径,建议使用绝对路径。默认为空,表示关闭 logStdout: true # 日志是否输出到终端。默认为true errorStack: true # 当Server捕获到异常时是否记录堆栈信息到日志中。默认为true errorLogEnabled: true # 是否记录异常日志信息到日志中。默认为true errorLogPattern: "error-{Ymd}.log" # 异常错误日志文件格式。默认为"error-{Ymd}.log" accessLogEnabled: true # 是否记录访问日志。默认为false accessLogPattern: "access-{Ymd}.log" # 访问日志文件格式。默认为"access-{Ymd}.log"

    访问不了显示 image

    正常访问显示 image

    opened by mijjjj 10
  • [建议] gconv.Scan 支持 protobuf.TimeStamppb 转换到 gtime.Time

    [建议] gconv.Scan 支持 protobuf.TimeStamppb 转换到 gtime.Time

    1. What version of Go and system type/arch are you using?

    go version go1.19.3 darwin/amd64

    2. What version of GoFrame are you using?

    v2.2.2

    3. Can this issue be re-produced with the latest release?

    yes

    4. What did you do?

    package tbase
    
    import (
    	"bytes"
    	"encoding/json"
    	"fmt"
    	"testing"
    
    	"github.com/gogf/gf/v2/os/gtime"
    	"github.com/gogf/gf/v2/util/gconv"
    	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
    	"google.golang.org/protobuf/types/known/timestamppb"
    )
    
    
    type AuthRes1 struct {
    	Name     string      `dc:"用户姓名"`
    	Nick     string      `dc:"用户昵称"`
    	Avatar   string      `dc:"头像"   `                            //
    	Sex      int         `dc:"性别 0女 1男 2未知" json:"Sex"      `    //
    	Status   int         `dc:"状态 -1禁用 1正常 0异常" json:"Status"   ` // -1禁用,1正常
    	Channel  string      `dc:"渠道" json:"Channel"  `              //
    	PUID     int64       `dc:"推介人" json:"PUID"     `             //
    	CNum     int64       `dc:"团队成员数" json:"CNum"     `           //
    	Birthday *gtime.Time `dc:"生日" json:"Birthday" `              //
    	UID      uint64      `dc:"用户号"`
    	Units    []SimUnit   `dc:"用户组织编号"`
    	AID      uint64      `dc:"应用编号"`
    	//当前企业
    	GID uint64 `dc:"企业或分组编号"`
    	Key string `dc:"SaaS应用分割"`
    	//角色 SysAdmin,SysOrgAdmin,SysMember,
    	Rule string `dc:"角色"`
    	// 用户组清单
    	Groups    []SimUserGroup `dc:"所在用户组数组"`
    	Prefix    string         ``
    	JWT       string         `dc:"JWT认证的字符串,用于跟第三方系统交互"`
    	JWTExpire *gtime.Time    `dc:"JWT过期时间"`
    }
    
    type AuthRes2 struct {
    	state         protoimpl.MessageState
    	sizeCache     protoimpl.SizeCache
    	unknownFields protoimpl.UnknownFields
    
    	// Tags: dc:"用户姓名"
    	Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
    	// Tags: dc:"用户昵称"
    	Nick string `protobuf:"bytes,2,opt,name=Nick,proto3" json:"Nick,omitempty"`
    	// Tags: dc:"头像"
    	Avatar string `protobuf:"bytes,3,opt,name=Avatar,proto3" json:"Avatar,omitempty"`
    	// Tags: dc:"性别 0女 1男 2未知" json:"Sex"
    	Sex int32 `protobuf:"varint,4,opt,name=Sex,proto3" json:"Sex,omitempty"`
    	// Tags: dc:"状态 -1禁用 1正常 0异常" json:"Status"
    	Status int32 `protobuf:"varint,5,opt,name=Status,proto3" json:"Status,omitempty"`
    	// Tags: dc:"渠道" json:"Channel"
    	Channel string `protobuf:"bytes,6,opt,name=Channel,proto3" json:"Channel,omitempty"`
    	// Tags: dc:"推介人" json:"PUID"
    	PUID int64 `protobuf:"varint,7,opt,name=PUID,proto3" json:"PUID,omitempty"`
    	// Tags: dc:"团队成员数" json:"CNum"
    	CNum int64 `protobuf:"varint,8,opt,name=CNum,proto3" json:"CNum,omitempty"`
    	// Tags: dc:"生日" json:"Birthday"
    	Birthday *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=Birthday,proto3" json:"Birthday,omitempty"`
    	// Tags: dc:"用户号"
    	UID uint64 `protobuf:"varint,10,opt,name=UID,proto3" json:"UID,omitempty"`
    	// Tags: dc:"用户组织编号"
    	Units []*SimUnit `protobuf:"bytes,11,rep,name=Units,proto3" json:"Units,omitempty"`
    	// Tags: dc:"应用编号"
    	AID uint64 `protobuf:"varint,12,opt,name=AID,proto3" json:"AID,omitempty"`
    	// Tags: dc:"企业或分组编号"
    	GID uint64 `protobuf:"varint,13,opt,name=GID,proto3" json:"GID,omitempty"`
    	// Tags: dc:"SaaS应用分割"
    	Key string `protobuf:"bytes,14,opt,name=Key,proto3" json:"Key,omitempty"`
    	// Tags: dc:"角色"
    	Rule string `protobuf:"bytes,15,opt,name=Rule,proto3" json:"Rule,omitempty"`
    	// Tags: dc:"所在用户组数组"
    	Groups []*SimUserGroup `protobuf:"bytes,16,rep,name=Groups,proto3" json:"Groups,omitempty"`
    	// Tags:
    	Prefix string `protobuf:"bytes,17,opt,name=Prefix,proto3" json:"Prefix,omitempty"`
    	// Tags: dc:"JWT认证的字符串,用于跟第三方系统交互"
    	JWT string `protobuf:"bytes,18,opt,name=JWT,proto3" json:"JWT,omitempty"`
    	// Tags: dc:"JWT过期时间"
    	JWTExpire *timestamppb.Timestamp `protobuf:"bytes,19,opt,name=JWTExpire,proto3" json:"JWTExpire,omitempty"`
    }
    
    func TestScan(t *testing.T) {
    	s := `{
            "Name": "真难什元处便半",
            "Nick": "赵伟",
            "Avatar": "http://dummyimage.com/100x100",
            "Sex": 18,
            "Status": 1,
            "Channel": "",
            "PUID": 0,
            "CNum": 0,
            "Birthday": "2007-02-18 00:00:00",
            "UID": 19,
            "Units": [],
            "AID": 0,
            "GID": 0,
            "Key": "",
            "Rule": "",
            "Groups": [],
            "Prefix": "",
            "JWT": "",
            "JWTExpire": null
        }`
    	buf := bytes.NewBufferString(s)
    	auth := AuthRes1{}
    	json.Unmarshal(buf.Bytes(), &auth)
    	bs, _ := json.Marshal(auth)
    	bstr := fmt.Sprintf("%s", bs)
    	n := 0
    	for i := 0; i < 1000; i++ {
    		tmp := &AuthRes2{}
    		gconv.Scan(auth, tmp)
    		tstr, _ := json.Marshal(*tmp)
    		if bstr != fmt.Sprintf("%s", tstr) {
    			fmt.Println("Name", tmp.Name)
    			n++
    		} else {
    			// fmt.Println("Match")
    		}
    	}
    	fmt.Println("n=", n)
    }
    
    

    5. What did you expect to see?

    Scan result should eq source

    6. What did you see instead?

    有时候会丢失转换的数据结果

    7.日志记录 logs

    image question 
    opened by YanCastle 4
  • pkg folder should not be ignored

    pkg folder should not be ignored

    1. What version of Go and system type/arch are you using?

    go version go1.19.3 linux/amd64

    2. What version of GoFrame are you using?

    2.2.4

    3. Can this issue be re-produced with the latest release?

    Yes

    4. What did you do?

    go mod vendor then go build xxx

    5. What did you expect to see?

    build success

    6. What did you see instead?

    #13 [builder 4/4] RUN make build
    #13 0.376 GO111MODULE=on CGO_ENABLED=0 go build -mod vendor -o bin/manager manage
    #13 1.044 vendor/k8s.io/client-go/discovery/discovery_client.go:35:2: cannot find package "." in:
    #13 1.044 /xx-service/vendor/k8s.io/apimachinery/pkg/api/errors
    

    Possible Solution

    change pkg/ to /pkg in .gitignore or delete this rule.

    opened by halfcrazy 0
  • build error

    build error

    build error:

    # github.com/gogf/gf/contrib/drivers/mysql/v2
    ../../pkg/mod/github.com/gogf/gf/contrib/drivers/mysql/[email protected]/mysql.go:76:37: config.Protocol undefined (type *gdb.ConfigNode has no field or method Protocol)
    ../../pkg/mod/github.com/gogf/gf/contrib/drivers/mysql/[email protected]/mysql.go:81:13: config.Extra undefined (type *gdb.ConfigNode has no field or method Extra)
    ../../pkg/mod/github.com/gogf/gf/contrib/drivers/mysql/[email protected]/mysql.go:82:49: config.Extra undefined (type *gdb.ConfigNode has no field or method Extra)
    ../../pkg/mod/github.com/gogf/gf/contrib/drivers/mysql/[email protected]/mysql.go:143:21: undefined: gutil.GetOrDefaultStr
    
    opened by askie 1
  • pgsql last insert 使用事务的时候无效

    pgsql last insert 使用事务的时候无效

    1. What version of Go and system type/arch are you using?

    go version go1.19 windows/amd64

    2. What version of GoFrame are you using?

    github.com/gogf/gf/v2 v2.2.4

    3. Can this issue be re-produced with the latest release?

    yes

    4. What did you do?

    执行下面语句报错 LastInsertId is not supported by this driver

    tenantId := 1
    	ctx := context.TODO()
    	g.DB().Transaction(ctx, func(ctx context.Context, tx *gdb.TX) (err error) {
    		res, err := dao.SystemDicCategory.Ctx(ctx).Data(&do.SystemDicCategory{
    			Id:       122,
    			Code:     "common2",
    			ParentId: 0,
    			Name:     "通用配置2",
    			TenantId: tenantId,
    		}).Insert()
    		if err != nil {
    			glog.Info(ctx, err)
    			return
    		}
    		categoryId, err := res.LastInsertId()
    		if err != nil {
    			glog.Info(ctx, err)
    			return
    		}
    		mapper.New(ctx).SetTenantId(tenantId).SystemDic(true).Data(&do.SystemDic{
    			Name:       "账号初始密码",
    			CategoryId: categoryId,
    			Value:      "123456",
    			Status:     1,
    			Sort:       0,
    		}).Insert()
    		return
    	})
    

    5. What did you expect to see?

    can get LastInsertId

    6. What did you see instead?

    exception: LastInsertId is not supported by this driver

    feature 
    opened by huagelong 0
  •   github.com/gogf/gf/database/gdb.(*DriverMysql).TableFields这个函数在运行一段时间缓存丢失或者其他错误后居然报错  interface conversion: interface {} is nil, not map[string]*gdb.TableField

    github.com/gogf/gf/database/gdb.(*DriverMysql).TableFields这个函数在运行一段时间缓存丢失或者其他错误后居然报错 interface conversion: interface {} is nil, not map[string]*gdb.TableField

    1. What version of Go and system type/arch are you using?

    Linux Centos Go 1.14

    2. What version of GoFrame are you using?

    gf 1.13.1

    3. Can this issue be re-produced with the latest release?

    No

    4. What did you do?

    github.com/gogf/gf/database/gdb.(*DriverMysql).TableFields这个函数在运行一段时间缓存丢失或者其他错误后居然报错

    interface conversion: interface {} is nil, not map[string]*gdb.TableField

    5. What did you expect to see?

    自动更新数据表结构,而且缓存丢失时能自动缓存回来

    6. What did you see instead?

    panic interface conversion: interface {} is nil, not map[string]*gdb.TableField

    opened by Charntent 0
Releases(v2.2.5)
Owner
GoFrame
The GoFrame Organization.
GoFrame
Package macaron is a high productive and modular web framework in Go.

Macaron Package macaron is a high productive and modular web framework in Go. Getting Started The minimum requirement of Go is 1.6. To install Macaron

Macaron 3.3k Nov 29, 2022
Mango is a modular web-application framework for Go, inspired by Rack, and PEP333.

Mango Mango is a modular web-application framework for Go, inspired by Rack and PEP333. Note: Not actively maintained. Overview Mango is most of all a

Paul Bellamy 371 Nov 17, 2022
hiboot is a high performance web and cli application framework with dependency injection support

Hiboot - web/cli application framework About Hiboot is a cloud native web and cli application framework written in Go. Hiboot is not trying to reinven

hidevops.io 179 Nov 20, 2022
A powerful go web framework for highly scalable and resource efficient web application

webfr A powerful go web framework for highly scalable and resource efficient web application Installation: go get -u github.com/krishpranav/webfr Exa

Krisna Pranav 13 Nov 28, 2021
A powerful go web framework for highly scalable and resource efficient web application

A powerful go web framework for highly scalable and resource efficient web application

null 22 Oct 3, 2022
henrylee2cn 1.6k Nov 18, 2022
Goal is a toolkit for high productivity web development in Go language in the spirit of Revel Framework that is built around the concept of code generation.

Goal Goal is a set of tools for high productivity web development in Go language. Goal, being mostly inspired by Revel Framework and its discussions,

null 88 Sep 27, 2021
GoFarm is an Application Development Framework for especially Backend Developer with Golang

What is GoFarm GoFarm is an Application Development Framework for especially Backend Developer with Golang. Our goal is to develop easier, standardize

Alvin Leonardo 2 Dec 9, 2021
Dragon 🐲 🐲 🐲 is a lightweight high performance web framework with Go for the feature and comfortable develop.

Dragon project new link start dragon ab performance Dragon ?? ?? ?? is a lightweight high performance web framework with Go for the feature and comfor

azerothyang 0 Sep 6, 2022
A fantastic modular Go web framework boiled with black magic.

A fantastic modular Go web framework boiled with black magic. Getting started The minimum requirement of Go is 1.16. To install Flamego: go get github

Flamego 428 Nov 21, 2022
Modular C2 framework aiming to ease post exploitation for red teamers.

test.mp4 testvideo.mp4 Usage: Inside the command server you can reference beacons using either their list id or their unique id. For example if the ou

meet 170 Nov 9, 2022
beego is an open-source, high-performance web framework for the Go programming language.

Beego Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend services. It is inspired by To

astaxie 578 Nov 29, 2022
High performance, minimalist Go web framework

Supported Go versions As of version 4.0.0, Echo is available as a Go module. Therefore a Go version capable of understanding /vN suffixed imports is r

LabStack LLC 24.3k Nov 30, 2022
Gearbox :gear: is a web framework written in Go with a focus on high performance

gearbox ⚙️ is a web framework for building micro services written in Go with a focus on high performance. It's built on fasthttp which is up to 10x fa

Gearbox 687 Nov 12, 2022
Gearbox :gear: is a web framework written in Go with a focus on high performance

gearbox ⚙️ is a web framework for building micro services written in Go with a focus on high performance. It's built on fasthttp which is up to 10x fa

Gearbox 688 Nov 28, 2022
High performance, simple Go web framework

Elton Elton的实现参考了koa以及echo,中间件的调整均为洋葱模型:请求由外至内,响应由内至外。主要特性如下: 处理函数(中间件)均以返回error的形式响应出错,方便使用统一的出错处理中间件将出错统一转换为对应的输出(JSON),并根据出错的类型等生成各类统计分析 成功响应数据直接赋值

Tree Xie 60 Nov 13, 2022
beego is an open-source, high-performance web framework for the Go programming language.

Beego Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend services. It is inspired by To

beego Framework 29.2k Nov 28, 2022
letgo is an open-source, high-performance web framework for the Go programming language.

high-performance Lightweight web framework for the Go programming language. golang web framework,高可用golang web框架,go语言 web框架 ,go web

wjp 350 Sep 23, 2022
Hexya business application development framework

Hexya Hexya is an open source ERP and a business application development framework written in Go. This repository houses the business application deve

Hexya 361 Nov 10, 2022