do

package
v0.0.0-...-9d33de4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

DO

用于数据表与Dao数据映射

实现如下接口,可以自定义结构体对应的数据表表名


type tabler interface {
	TableName() string
}

Documentation

Overview

* @Package do * @Author Quan Chen * @Date 2020/3/19 * @Description *

* @Package do * @Author Quan Chen * @Date 2020/3/19 * @Description *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentDO

type CommentDO struct {
	models.Comment
	FromUser UserDo `json:"from_user" gorm:"foreignkey:FromUserId"`
	ToUser   UserDo `json:"to_user" gorm:"foreignkey:ToUserId"`
}

func (CommentDO) TableName

func (CommentDO) TableName() string

命名数据表名

type UserDo

type UserDo struct {
	models.Model
	Username    string `json:"username" grom:"column:username;not null"`     // 用户名
	Name        string `json:"name"  grom:"column:name;not null"`            // 昵称
	Description string `json:"description" grom:"column:description"`        // 描述
	Sex         int    `json:"sex" grom:"column:sex;not null"`               // 性别
	AvatarSrc   string `json:"avatar_src" grom:"column:avatar_src;not null"` // 头像地址
	Email       string `json:"email" grom:"column:email"`                    // 电子邮件
	WebSite     string `json:"web_site" grom:"column:web_site"`              // 网站
	Company     string `json:"company" grom:"column:company"`                // 公司
	Position    string `json:"position" grom:"column:position"`              // 职位
}

UserDo

func (UserDo) TableName

func (UserDo) TableName() string

命名数据表名

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL