Documentation ¶
Index ¶
- Variables
- func CheckPassword(inputPassword, targetPassword string) bool
- func Connect(drv Driver, dsn string, name ...string) error
- func ConnectionNames() []string
- func DecodeURIComponent(str string) string
- func DiffDays(start, end time.Time) []time.Time
- func DiffDaysString(start, end time.Time) []string
- func Disconnect(name ...string)
- func DisconnectAll()
- func EncodeURIComponent(str string) string
- func EnsureDir(p string) error
- func GenDDL(schemas map[string]*Schema, dsnName ...string) string
- func GenPassword(inputPassword string) (string, error)
- func GetFileMD5Sum(filePath string) (string, error)
- func IsAudio(filePath string) bool
- func IsImage(filePath string) bool
- func IsVideo(filePath string) bool
- func JSONParse(s string, v any) error
- func JSONStringify(v any, format ...bool) string
- func MD5Str(str string) string
- func MarkdownFindAndReplaceURLs(result string, keepText bool) (string, []string)
- func NewRandomNumber(length int) string
- func NewUUID(upper bool, hyphen bool) string
- func NewUUIDToken() string
- func NextSnowflakeID() snowflake.ID
- func NextSnowflakeIntID() int64
- func NextSnowflakeStringID() string
- func ParseNullBool(s string) null.Bool
- func ParseNullFloat(s string) null.Float
- func ParseNullInt(s string) null.Int
- func ParseNullString(s, defaultValue string) null.String
- func ParseTag(tagName string) map[string]string
- func PathExists(p string) (bool, error)
- func RegisterSchemas(values ...any) error
- func Schemas(name ...string) map[string]*Schema
- type Connection
- type Driver
- type Field
- type File
- type FileKind
- type FilepathObject
- type Namespace
- func (ns *Namespace) Connect(name string, drv Driver, dsn string) (*Connection, error)
- func (ns *Namespace) ConnectionNames() []string
- func (ns *Namespace) Disconnect(name ...string)
- func (ns *Namespace) DisconnectAll()
- func (ns *Namespace) LookupConnection(name ...string) *Connection
- func (ns *Namespace) LookupSchema(name string) *Schema
- func (ns *Namespace) RegisterSchemas(value ...any) error
- func (ns *Namespace) RepairRelationships()
- func (ns *Namespace) Schemas(names ...string) map[string]*Schema
- type Relationship
- type Schema
- type SchemaInterface
- type SchemaRelationship
- type SchemaType
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckPassword ¶
func ConnectionNames ¶
func ConnectionNames() []string
func DecodeURIComponent ¶
func DiffDaysString ¶
func Disconnect ¶
func Disconnect(name ...string)
func DisconnectAll ¶
func DisconnectAll()
func EncodeURIComponent ¶
func GenPassword ¶
func GetFileMD5Sum ¶
func JSONStringify ¶
func NewRandomNumber ¶
func NewUUIDToken ¶
func NewUUIDToken() string
func NextSnowflakeID ¶
func NextSnowflakeIntID ¶
func NextSnowflakeIntID() int64
func NextSnowflakeStringID ¶
func NextSnowflakeStringID() string
func ParseNullBool ¶
func ParseNullBool(s string) null.Bool
func ParseNullFloat ¶
func ParseNullFloat(s string) null.Float
func ParseNullInt ¶
func ParseNullInt(s string) null.Int
func ParseNullString ¶
func ParseNullString(s, defaultValue string) null.String
func PathExists ¶
func RegisterSchemas ¶
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func LookupConnection ¶
func LookupConnection(name string) *Connection
type Field ¶
type Field struct { Name string `json:"name,omitempty"` NativeName string `json:"native_name,omitempty"` Type SchemaType `json:"type,omitempty"` ItemType string `json:"item_type,omitempty"` NativeType string `json:"native_type,omitempty"` Title string `json:"title,omitempty"` Description null.String `json:"description,omitempty"` Relationship Relationship `json:"relationship,omitempty"` RelConfig string `json:"rel_config,omitempty"` IsPrimary bool `json:"is_primary"` IsUnsigned bool `json:"is_unsigned"` IsAutoIncrement bool `json:"is_auto_increment"` // TODO 默认值配置实现 //DefaultConfig string // TODO 必填配置实现 IsRequired bool `json:"is_required"` RequiredConfig string `json:"required_config,omitempty"` }
type File ¶
type File struct { ThumbID null.String `mod:"缩略图ID"` ThumbPath null.String `mod:"缩略图"` ThumbURL null.String `mod:"缩略图"` Duration null.Float `mod:"音/视频时长(秒)"` UUID string `mod:"文件唯一ID"` FileKind FileKind `mod:"文件类型"` MineType string `mod:"文件Mine-Type"` // 如image/jpeg Name string `mod:"文件名称"` Path string `mod:"存储路径"` Ext string `mod:"文件扩展名"` URL string `mod:"下载路径"` Size null.Int `mod:"文件大小"` Sort null.Int `mod:"排序值"` MD5Sum null.String `mod:"MD5校验码"` Width null.Int `mod:"宽度"` Height null.Int `mod:"高度"` Clazz null.String `mod:"文件分类"` OwnerID null.Int `mod:"所属数据ID"` OwnerType null.String `mod:"所属数据类型"` // contains filtered or unexported fields }
type FilepathObject ¶
type FilepathObject struct { Raw string FileNameNoExt string FullFileName string FileExt string FileDir string }
func ParseFilepath ¶
func ParseFilepath(fileURL string) (fo *FilepathObject)
type Namespace ¶
type Namespace struct { Name string // contains filtered or unexported fields }
func (*Namespace) ConnectionNames ¶
func (*Namespace) Disconnect ¶
func (*Namespace) DisconnectAll ¶
func (ns *Namespace) DisconnectAll()
func (*Namespace) LookupConnection ¶
func (ns *Namespace) LookupConnection(name ...string) *Connection
func (*Namespace) LookupSchema ¶
func (*Namespace) RegisterSchemas ¶
func (*Namespace) RepairRelationships ¶
func (ns *Namespace) RepairRelationships()
type Relationship ¶
type Relationship struct { Kind SchemaRelationship `json:"kind,omitempty"` SrcSchemaName string `json:"src_schema_name,omitempty"` SrcSchemaField string `json:"src_schema_field,omitempty"` DstSchemaName string `json:"dst_schema_name,omitempty"` DstSchemaField string `json:"dst_schema_field,omitempty"` BrgSchemaName string `json:"brg_schema_name,omitempty"` BrgSchemaSrcField string `json:"brg_schema_src_field,omitempty"` BrgSchemaDstField string `json:"brg_schema_dst_field,omitempty"` BrgIsNative bool `json:"brg_is_native,omitempty"` }
type Schema ¶
type Schema struct { Name string `json:"name,omitempty"` NativeName string `json:"native_name,omitempty"` Description string `json:"description,omitempty"` Fields map[string]Field `json:"fields,omitempty"` // contains filtered or unexported fields }
func LookupSchema ¶
func ParseSchemas ¶
func (*Schema) PrimaryKey ¶
func (*Schema) PrimaryKeys ¶
type SchemaInterface ¶
type SchemaInterface interface {
Schema() Schema
}
type SchemaRelationship ¶
type SchemaRelationship string
const ( RelationshipHasOne SchemaRelationship = "HAS_ONE" RelationshipHasMany SchemaRelationship = "HAS_MANY" RelationshipRefOne SchemaRelationship = "REF_ONE" RelationshipRefMany SchemaRelationship = "REF_MANY" )
type SchemaType ¶
type SchemaType string
const ( String SchemaType = "string" Integer SchemaType = "integer" Float SchemaType = "float" Boolean SchemaType = "boolean" Time SchemaType = "time" Object SchemaType = "object" Array SchemaType = "array" )
Click to show internal directories.
Click to hide internal directories.