Documentation
¶
Index ¶
- Constants
- func Atoi(num string, base int) int64
- func Atoid(num string) int64
- func ContentDisposition(filename string, dispositionType ContentDispositionType) (disposition string)
- func Flat[T flatType](from T) *flatConverter[T]
- func FormatInt(num int64, base int) string
- func FormatIntd(num int64) string
- func Gid() (id uint64)
- func If[T any](test bool, first T, second T) (t T)
- func Index[T any](items *[]T, item T) (index int)
- func Md5(from string) (to string, err error)
- func RenderToFile(filename string, input string, data interface{}, isFile bool) (err error)
- func Set[T any](setter func(value T), first T, second T)
- func Sha256Hmac(data string, secret string) (sha string, err error)
- func SymmetricKey(bits uint) (key []byte, err error)
- type CannotCompare
- type CannotCopy
- type Case
- type ContentDispositionType
- type Created
- type Deleted
- type Field
- type Fields
- type HttpMethod
- type HttpParameterType
- type Id
- type Key
- type Kv
- type Model
- type Object
- type Package
- type Size
- type SoftDeleted
- type Updated
- type UriScheme
- type User
- type Value
Constants ¶
View Source
const ( // CasePositionNone 无 CasePositionNone casePosition = iota // CasePositionHead 首 CasePositionHead // CasePositionTail 尾 CasePositionTail // CasePositionAll 全部 CasePositionAll )
View Source
const ( // StringEmpty 空字符串 StringEmpty = "" StringSpace = " " // Float64Size 64位长度 Float64Size = 64 )
View Source
const ( // HeaderAcceptLanguage 可接受的语言 HeaderAcceptLanguage = "Accept-Language" // HeaderContentType 请求数据类型 HeaderContentType = "Content-Type" // HeaderAuthorization 授权 HeaderAuthorization = "Authorization" // HeaderContentDisposition 下载时的附件名指定 HeaderContentDisposition = "Content-disposition" // HttpMethodGet GET方法 HttpMethodGet HttpMethod = "GET" // HttpMethodPost POST方法 HttpMethodPost HttpMethod = "POST" // HttpMethodPut PUT方法 HttpMethodPut HttpMethod = "PUT" // HttpMethodDelete DELETE方法 HttpMethodDelete HttpMethod = "DELETE" // HttpMethodPatch PATCH方法 HttpMethodPatch HttpMethod = "PATCH" // HttpMethodHead HEAD方法 HttpMethodHead HttpMethod = "HEAD" // HttpMethodOptions OPTIONS方法 HttpMethodOptions HttpMethod = "OPTIONS" )
Variables ¶
This section is empty.
Functions ¶
func ContentDisposition ¶
func ContentDisposition(filename string, dispositionType ContentDispositionType) (disposition string)
ContentDisposition 解决附件下载乱码
func RenderToFile ¶
RenderToFile 渲染模板到文件
func Set ¶ added in v0.1.3
func Set[T any](setter func(value T), first T, second T)
Set 设置方法,当`first`值为零值时,设置为`second`的值,否则设置`first`的值
func Sha256Hmac ¶
Sha256Hmac 计算SHA256加密
Types ¶
type Case ¶ added in v0.1.3
type Case string
Case 字符串转换
func (*Case) Underscore ¶ added in v0.1.3
Underscore 转为下划线写法
type ContentDispositionType ¶
type ContentDispositionType string
ContentDispositionType 下载类型
const ( // ContentDispositionTypeAttachment 附件下载 ContentDispositionTypeAttachment ContentDispositionType = "attachment" // ContentDispositionTypeInline 浏览器直接打开 ContentDispositionTypeInline ContentDispositionType = "inline" )
type Created ¶ added in v0.1.3
type Created struct { // 创建时间 Created time.Time `xorm:"created default('2020-02-04 09:55:52')" json:"created"` }
Created 带创建时间模型
type Deleted ¶ added in v0.1.3
type Deleted struct { // 删除时间,用户软删除 Deleted time.Time `xorm:"deleted default('2020-02-04 09:55:52')" json:"deleted"` }
Deleted 软删除模型
type Fields ¶
Fields 字段列表
func (Fields[T]) Connect ¶
func (f Fields[T]) Connect(field Field[T]) (new Fields[T])
Connect 连接其它字段
type HttpParameterType ¶
type HttpParameterType string
HttpParameterType Http额外参数类型
const ( // HttpParameterTypeHeader 请求头 HttpParameterTypeHeader HttpParameterType = "header" // HttpParameterTypePathParameter 路径参数 HttpParameterTypePathParameter HttpParameterType = "path" )
type Id ¶
type Id struct { // Id 编号 Id int64 `xorm:"pk notnull unique index('idx_id') default(0)" json:"id,string"` }
Id 带序列号的模型
type Size ¶
type Size int64
Size 字节大小
func (*Size) MarshalJSON ¶ added in v0.0.7
func (*Size) UnmarshalJSON ¶ added in v0.0.7
type SoftDeleted ¶ added in v0.1.3
SoftDeleted 带软删除功能的数据库模型
type Updated ¶ added in v0.1.3
type Updated struct { // 最后更新时间 Updated time.Time `xorm:"updated default('2020-02-04 09:55:52')" json:"updated"` }
Updated 带修改时间模型
type UriScheme ¶ added in v0.1.3
type UriScheme string
UriScheme 协议
const ( // UriSchemeUnknown 未知协议 UriSchemeUnknown UriScheme = `` // UriSchemeSocksV4 Socks协议 UriSchemeSocksV4 UriScheme = "socks4" // UriSchemeSocksV5 Socks协议 UriSchemeSocksV5 UriScheme = "socks4" // UriSchemeHttp Http协议 UriSchemeHttp UriScheme = "http" // UriSchemeHttps Https协议 UriSchemeHttps UriScheme = "https" // UriSchemeRtmp Rtmp协议 UriSchemeRtmp UriScheme = "rtmp" // UriSchemeMqtt MQTT协议 UriSchemeMqtt UriScheme = "mqtt" // UriSchemeMqtts MQTT安全协议 UriSchemeMqtts UriScheme = "mqtts" // UriSchemeWs Websocket协议 UriSchemeWs UriScheme = "ws" // UriSchemeWss Websocket安全协议 UriSchemeWss UriScheme = "wss" )
type User ¶ added in v0.1.3
type User struct { Model `xorm:"extends"` // 用户名 Username string `xorm:"varchar(32) notnull default('') unique(uidx_name)" json:"username" validate:"omitempty,min=1,max=32,email"` // 手机号 // 类似于+86-17089792784 Phone string `xorm:"varchar(15) notnull default('') unique(uidx_phone)" json:"phone" validate:"omitempty,mobile"` // 密码 Passwd string `xorm:"varchar(512) notnull default('')" json:"-"` }
User 基础用户数据
Source Files
¶
- cannot_compare.go
- cannot_copy.go
- case.go
- case_position.go
- const.go
- coroutine.go
- created.go
- deleted.go
- deleted_soft.go
- encrypt.go
- field.go
- flat.go
- http.go
- id.go
- if.go
- index.go
- itoa.go
- key.go
- kv.go
- model.go
- object.go
- package.go
- set.go
- size.go
- size_formatter.go
- string_field.go
- template.go
- updated.go
- uri_scheme.go
- user.go
- value.go
Click to show internal directories.
Click to hide internal directories.