GithubHelp home page GithubHelp logo

Comments (2)

wln32 avatar wln32 commented on September 23, 2024

Please provide the database table structures for [dao.Blog], [pbentity.Blog], and related information to facilitate the replication of bugs

from gf.

yiqiang3344 avatar yiqiang3344 commented on September 23, 2024

@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)

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.