Comments (2)
Please provide the database table structures for [dao.Blog], [pbentity.Blog], and related information to facilitate the replication of bugs
from gf.
@wln32
dao.Blog
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"github.com/yiqiang3344/gf-micro/example/blog/internal/dao/internal"
)
// internalBlogDao is internal type for wrapping internal DAO implements.
type internalBlogDao = *internal.BlogDao
// blogDao is the data access object for table blog.
// You can define custom methods on it to extend its functionality as you wish.
type blogDao struct {
internalBlogDao
}
var (
// Blog is globally public accessible object for table blog operations.
Blog = blogDao{
internal.NewBlogDao(),
}
)
// Fill with you ideas below.
dao.internal.blog
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// BlogDao is the data access object for table blog.
type BlogDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns BlogColumns // columns contains all the column names of Table for convenient usage.
}
// BlogColumns defines and stores column names for table blog.
type BlogColumns struct {
Id string // Blog ID
Title string // Title
Content string // Content
Nickname string // Nickname
CreateAt string // Created Time
UpdateAt string // Updated Time
DeleteAt string // Deleted Time
}
// blogColumns holds the columns for table blog.
var blogColumns = BlogColumns{
Id: "id",
Title: "title",
Content: "content",
Nickname: "nickname",
CreateAt: "create_at",
UpdateAt: "update_at",
DeleteAt: "delete_at",
}
// NewBlogDao creates and returns a new DAO object for table data access.
func NewBlogDao() *BlogDao {
return &BlogDao{
group: "default",
table: "blog",
columns: blogColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *BlogDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *BlogDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *BlogDao) Columns() BlogColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *BlogDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *BlogDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *BlogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}
pbentity.blog.proto
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
syntax = "proto3";
package pbentity;
option go_package = "github.com/yiqiang3344/gf-micro/example/blog/api/pbentity";
import "google/protobuf/timestamp.proto";
message Blog {
uint32 Id = 1 ; // Blog ID
string Title = 2 ; // Title
string Content = 3 ; // Content
string Nickname = 4 ; // Nickname
google.protobuf.Timestamp CreateAt = 5 ; // Created Time
google.protobuf.Timestamp UpdateAt = 6 ; // Updated Time
google.protobuf.Timestamp DeleteAt = 7 ; // Deleted Time
}
from gf.
Related Issues (20)
- github.com/gogf/gf/v2/frame/g cannot get instance HOT 1
- frame/g: The random sorting method in gdb is not compatible with Sqlite HOT 1
- cli: Use the gf gen dao command to generate sqlite entities, and the results are all empty structures. HOT 4
- cmd/gf: gf run watched HOT 4
- github.com/gogf/gf/contrib/registry/file/[email protected]: issue file_discovery.go第97行不要执行gfile.Remove(filePath)
- os/gtime: 使用MSSQL处理事务回滚时报错ROLLBACK: mssql: ROLLBACK TRANSACTION 请求没有对应的 BEGIN TRANSACTION。
- database/gdb: When using a custom operator, the Where/WhereOr method does not wrap the field name with a keyword identifier, resulting in a syntax error in SQL execution
- encoding/gjson: json转xml时特殊字符未能转换,导致xml格式不正确,也不能正确还原回json HOT 4
- Simplify HOT 4
- os/log: extra time prefix HOT 2
- gconv struct to map bug,omitempty标签无效 HOT 4
- net/ghttp: (s *Server) Restart is not available HOT 1
- WriteJsonExit returns 4 more characters null. HOT 12
- gf gen ctrl multi-configuration
- cmd/gf: gf init app/mono -a
- ghttp: I hope ghttp.Request can expose the req parameter when the router bind is object method. HOT 1
- util/gconv: After conversion, the interface{} type becomes *interface {} HOT 11
- os/gtime: issue title HOT 2
- cmd/genservice: It is recommended that the generated service supports multiple implementations HOT 1
- orm return err ideas
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gf.