Documentation
¶
Overview ¶
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-11 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2026-05-08 15:00:00 * @FilePath: \go-sqlbuilder\types\helpers.go * @Description: 内部辅助函数 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-11 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2026-05-08 15:05:00 * @FilePath: \go-sqlbuilder\types\json.go * @Description: JSON - 泛型 JSON 类型,支持任意可序列化类型的数据库存储 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-11 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2026-05-08 15:15:19 * @FilePath: \go-sqlbuilder\types\map_any.go * @Description: MapAny - 任意类型 Map,支持数据库 JSON 序列化 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2026-05-09 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2026-05-11 12:57:50 * @FilePath: \go-sqlbuilder\types\proto_json.go * @Description: ProtoJSON - 泛型 protobuf JSON 类型,支持 protobuf 消息的数据库存储 * * Copyright (c) 2026 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-11 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2026-05-08 15:00:00 * @FilePath: \go-sqlbuilder\types\slice.go * @Description: Slice - 泛型切片类型,支持数据库 JSON 序列化 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-11 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2026-05-08 15:00:00 * @FilePath: \go-sqlbuilder\types\string_slice.go * @Description: StringSlice - 字符串切片,支持数据库 JSON 序列化和分隔符解析 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
Index ¶
- type JSON
- type MapAny
- func (m MapAny) Clone() MapAny
- func (m MapAny) Delete(key string) MapAny
- func (m MapAny) Get(key string, defaultValue ...any) any
- func (m MapAny) GetBool(key string, defaultValue ...bool) bool
- func (m MapAny) GetInt(key string, defaultValue ...int) int
- func (m MapAny) GetString(key string, defaultValue ...string) string
- func (m MapAny) Has(key string) bool
- func (m MapAny) Keys() []string
- func (m MapAny) Merge(other MapAny) MapAny
- func (m *MapAny) Scan(value interface{}) error
- func (m MapAny) Set(key string, value any) MapAny
- func (m MapAny) Value() (driver.Value, error)
- func (m MapAny) Values() []any
- type ProtoJSON
- type ProtoJSONMap
- type Slice
- type StringSlice
- func (s *StringSlice) Append(items ...string) StringSlice
- func (s StringSlice) Clone() StringSlice
- func (s StringSlice) Contains(item string) bool
- func (s StringSlice) Filter(fn func(string) bool) StringSlice
- func (s *StringSlice) FromDelimitedString(input string, delimiters ...string) StringSlice
- func (s StringSlice) IndexOf(item string) int
- func (s StringSlice) Join(sep string) string
- func (s StringSlice) Map(fn func(string) string) StringSlice
- func (s *StringSlice) Remove(item string) StringSlice
- func (s *StringSlice) RemoveAt(index int) StringSlice
- func (s *StringSlice) Scan(value interface{}) error
- func (s StringSlice) Unique() StringSlice
- func (s StringSlice) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapAny ¶
MapAny 任意类型的 Map,支持数据库 JSON 序列化
type ProtoJSON ¶
type ProtoJSON[T any] struct { Data T }
ProtoJSON 泛型 protobuf JSON 类型,支持 protobuf 消息的数据库存储
type ProtoJSONMap ¶
ProtoJSONMap - 泛型 protobuf JSON 类型,支持 protobuf 消息的数据库存储
func NewProtoJSONMap ¶
func NewProtoJSONMap[T proto.Message]() *ProtoJSONMap[T]
NewProtoJSONMap - 创建一个新的 protobuf JSON 类型映射
func (*ProtoJSONMap[T]) Get ¶
func (p *ProtoJSONMap[T]) Get(key string) T
Get - 获取指定键的 protobuf JSON 类型值
func (*ProtoJSONMap[T]) Scan ¶
func (p *ProtoJSONMap[T]) Scan(value interface{}) error
func (*ProtoJSONMap[T]) Set ¶
func (p *ProtoJSONMap[T]) Set(key string, data T)
Set - 设置指定键的 protobuf JSON 类型值
type StringSlice ¶
type StringSlice []string
StringSlice 字符串切片,支持数据库 JSON 序列化
func ParseStringSlice ¶
func ParseStringSlice(input []string) StringSlice
ParseStringSlice 从混合格式解析字符串切片 支持数组或分隔字符串 (分号;换行符\n)
func (StringSlice) Filter ¶
func (s StringSlice) Filter(fn func(string) bool) StringSlice
Filter 过滤元素
func (*StringSlice) FromDelimitedString ¶
func (s *StringSlice) FromDelimitedString(input string, delimiters ...string) StringSlice
FromDelimitedString 从分隔符字符串创建 StringSlice 支持多种分隔符: 分号(;)、换行符(\n)、逗号(,) 自动去除空白字符和空字符串
func (*StringSlice) Remove ¶
func (s *StringSlice) Remove(item string) StringSlice
Remove 移除指定元素(第一个匹配的)
func (*StringSlice) RemoveAt ¶
func (s *StringSlice) RemoveAt(index int) StringSlice
RemoveAt 移除指定索引的元素
func (*StringSlice) Scan ¶
func (s *StringSlice) Scan(value interface{}) error