# starter-gorm **Repository Path**: go-spring2/starter-gorm ## Basic Information - **Project Name**: starter-gorm - **Description**: starter-gorm - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-04 - **Last Updated**: 2025-04-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # starter-gorm [English](README_EN.md) [仅发布] 该项目仅为最终发布,不要向该项目直接提交代码,开发请关注 [go-spring](https://gitee.com/go-spring2/go-spring) 项目。 ## Installation ### Prerequisites - Go >= 1.12 ### Using go get ``` go get gitee.com/go-spring2/starter-gorm@v1.1.0-rc2 ``` ## Quick Start ``` import "gitee.com/go-spring2/starter-gorm/mysql" ``` `main.go` ``` package main import ( "fmt" "gitee.com/go-spring2/spring-base/log" "gitee.com/go-spring2/spring-core/gs" "gorm.io/gorm" _ "gitee.com/go-spring2/starter-gorm/mysql" ) type runner struct { DB *gorm.DB `autowire:""` } func (r *runner) Run(ctx gs.Context) { var engines []string r.DB.Raw("select engine from engines").Scan(&engines) log.Infof("got mysql engines %v", engines) go gs.ShutDown() } func main() { gs.Object(&runner{}).Export((*gs.AppRunner)(nil)) fmt.Printf("program exited %v\n", gs.Web(false).Run()) } ``` `application.properties` ``` db.url=root:@/information_schema?charset=utf8&parseTime=True&loc=Local ``` ## Customization