Documentation
¶
Overview ¶
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-11 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-11-23 22:50:00 * @FilePath: \go-sqlbuilder\mapopt.go * @Description: Map类型扩展 - MapAny、MapString、StringSlice的数据库序列化和泛型操作 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
Index ¶
- type JSONType
- 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 MapString
- func (m MapString) Clone() MapString
- func (m MapString) Delete(key string) MapString
- func (m MapString) Get(key string, defaultValue ...string) string
- func (m MapString) Has(key string) bool
- func (m MapString) Keys() []string
- func (m MapString) Merge(other MapString) MapString
- func (m *MapString) Scan(value interface{}) error
- func (m MapString) Set(key, value string) MapString
- func (m MapString) ToMapAny() MapAny
- func (m MapString) Value() (driver.Value, error)
- func (m MapString) Values() []string
- 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 MapString ¶
MapString 字符串类型的 Map,支持数据库 JSON 序列化
type Slice ¶ added in v0.1.7
type Slice[T any] []T
泛型切片类型
type StringSlice ¶
type StringSlice []string
StringSlice 字符串切片,支持数据库 JSON 序列化
func ParseStringSlice ¶ added in v0.3.3
func ParseStringSlice(input []string) StringSlice
ParseStringSlice 从混合格式解析字符串切片 支持数组或分隔字符串 (分号;换行符\n)
func (*StringSlice) Append ¶ added in v0.1.7
func (s *StringSlice) Append(items ...string) StringSlice
Append 追加元素
func (StringSlice) Contains ¶ added in v0.1.7
func (s StringSlice) Contains(item string) bool
Contains 检查是否包含指定元素
func (StringSlice) Filter ¶ added in v0.1.7
func (s StringSlice) Filter(fn func(string) bool) StringSlice
Filter 过滤元素
func (*StringSlice) FromDelimitedString ¶ added in v0.3.3
func (s *StringSlice) FromDelimitedString(input string, delimiters ...string) StringSlice
FromDelimitedString 从分隔符字符串创建 StringSlice 支持多种分隔符: 分号(;)、换行符(\n)、逗号(,) 自动去除空白字符和空字符串
func (StringSlice) IndexOf ¶ added in v0.1.7
func (s StringSlice) IndexOf(item string) int
IndexOf 查找元素索引,未找到返回 -1
func (StringSlice) Map ¶ added in v0.1.7
func (s StringSlice) Map(fn func(string) string) StringSlice
Map 映射转换
func (*StringSlice) Remove ¶ added in v0.1.7
func (s *StringSlice) Remove(item string) StringSlice
Remove 移除指定元素(第一个匹配的)
func (*StringSlice) RemoveAt ¶ added in v0.1.7
func (s *StringSlice) RemoveAt(index int) StringSlice
RemoveAt 移除指定索引的元素
func (*StringSlice) Scan ¶
func (s *StringSlice) Scan(value interface{}) error
Directories
¶
| Path | Synopsis |
|---|---|
|
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-23 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-11-26 21:55:50 * @FilePath: \go-sqlbuilder\constants\operators.go * @Description: 操作符常量定义 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-23 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-11-26 21:55:50 * @FilePath: \go-sqlbuilder\constants\operators.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: 2025-11-23 13:05:48 * @FilePath: \go-sqlbuilder\db\handler.go * @Description: 数据库处理器 - Handler 接口和 GORM 实现 * * 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: 2025-11-23 13:05:48 * @FilePath: \go-sqlbuilder\db\handler.go * @Description: 数据库处理器 - Handler 接口和 GORM 实现 * * Copyright (c) 2025 by kamalyes, All Rights Reserved. |
|
* @Author: kamalyes 501893067@qq.com * @Date: 2025-12-13 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-12-13 10:26:53 * @FilePath: \go-sqlbuilder\errors\checker.go * @Description: 数据库错误检测工具函数 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2025-12-13 00:00:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-12-13 10:26:53 * @FilePath: \go-sqlbuilder\errors\checker.go * @Description: 数据库错误检测工具函数 * * Copyright (c) 2025 by kamalyes, All Rights Reserved. |
|
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-11 21:13:15 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-12-04 09:15:32 * @FilePath: \go-sqlbuilder\repository\base.go * @Description: * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
|
* @Author: kamalyes 501893067@qq.com * @Date: 2025-11-11 21:13:15 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-12-04 09:15:32 * @FilePath: \go-sqlbuilder\repository\base.go * @Description: * * Copyright (c) 2025 by kamalyes, All Rights Reserved. |