xuser

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: BSD-3-Clause-Clear Imports: 6 Imported by: 0

Documentation

Overview

用户模块

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdditionalUsers added in v0.2.1

func AdditionalUsers(tid uint, val string) []uint

根据用户附加属性获取对应的用户列表

tid	分类id,0-所有
val	附加属性名称

func CreateAdditional added in v0.2.0

func CreateAdditional(uid, tid uint, val string) error

创建用户附加属性

uid	用户ID
tid	类型ID
val	附加属性值

func GetAdditional added in v0.2.0

func GetAdditional(uid, tid uint) ([]string, error)

获取用户附加属性

uid	用户ID
tid	类型ID

func Regedit

func Regedit(c *Config)

配置项的注入

func RemoveAdditional added in v0.2.0

func RemoveAdditional(uid, tid uint, val string) error

移除用户附加属性

uid	用户ID
tid	类型ID
val	附加属性值

Types

type Config

type Config struct {
	DB                      *gorm.DB
	AdditionalPropertyTable string           // 附加属性表表名
	AdditionalType          map[uint]string  // 附加属性类型
	UserLinkTable           string           // 用户关系关联表表名
	UserLinkMap             map[uint8]string // 用户关联关系字典
}

此模块包含: 1. 附加属性功能(其中固定属性直接使用方进行固定即可,如昵称、头像、性别等直接固定到最外层用户表) 2. 用户关联功能

配置项信息

type UserAdditional added in v0.2.0

type UserAdditional struct {
	Id        uint   `gorm:"column:id;type:int unsigned;primaryKey;autoIncrement;not null" form:"id" json:"id"`
	UserId    uint   `gorm:"column:user_id;type:int unsigned;comment:所属用户" form:"user_id" json:"user_id"`              //所属用户
	TypeId    uint   `gorm:"column:type_id;type:int unsigned;comment:附加属性类型" form:"type_id" json:"type_id"`            //附加属性类型
	Value     string `gorm:"column:value;type:varchar(200);comment:附加属性值" form:"value" json:"value"`                   //附加属性值
	IsDeleted uint8  `gorm:"column:is_deleted;type:tinyint unsigned;comment:是否删除" form:"is_deleted" json:"is_deleted"` //是否删除
	CreatedAt string `gorm:"column:created_at;type:datetime;comment:添加时间" form:"created_at" json:"created_at"`         //添加时间
}

用户附加属性表

func (*UserAdditional) TableName added in v0.2.0

func (c *UserAdditional) TableName() string

返回所属表名信息

Jump to

Keyboard shortcuts

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