srv

package
v0.0.0-...-2c9a373 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package srv 主要是业务相关的代码 例如用户,订单等的处理。但因为order.go和user.go都会放在Package files内容下,所以此处的注释粒度是包维度,而不是文件级别

更多信息可参考这个链接:https://xxxx.com

Index

Constants

View Source
const CountryCode = "+86"

只有大写开头的会被导出到文档

Variables

View Source
var (
	/*
		仅大写的全局变量会被导出到文档
		这段内容想要显示,不能与下段可被导出的内容间有空行
	*/
	// 时间格式;
	TimeLayOut = time.Layout
)

Functions

func EncryptPassword

func EncryptPassword(password string) string

对用户密码进行加密

对 盐+原始密码 这个字符串进行bcrypt操作; TODO:对应的校验密码的方法待开发

func IsNomalOrder

func IsNomalOrder(bizTyp int8) bool

判断订单类型是否合法

Types

type GenderEnum

type GenderEnum int8
const (
	// 男性用户
	Male GenderEnum = 1
	// 女性用户
	FeMale GenderEnum = 2
)

type Order

type Order struct {
	// 订单ID
	ID int64
	// 订单类型
	BizTyp int8
	// 订单金额
	Number float64
	// 发生订单的手机号,与用户关联
	Phone string
}

type User

type User struct {
	// 用户名称,如果用户未设置则随机生成
	Name string
	// 年龄
	Age int
	// 地址
	Address string

	// 密码
	// 注意:存数据库时需要对用户密码进行哈希加盐
	Password string

	Gender GenderEnum

	IsVip bool // 这样写注释也会被原样解析到文档;与上下两个字段之间的空行也会被原样解析到文档

	/*
		也支持这样的注释方式
	*/
	Phone string // 用Phone作为唯一标识
}

User 用户相关信息

Jump to

Keyboard shortcuts

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