xorm: xorm.io/xorm/names Index | Files

package names

import "xorm.io/xorm/names"

Index

Package Files

mapper.go table_name.go

Variables

var LintGonicMapper = GonicMapper{
    "API":   true,
    "ASCII": true,
    "CPU":   true,
    "CSS":   true,
    "DNS":   true,
    "EOF":   true,
    "GUID":  true,
    "HTML":  true,
    "HTTP":  true,
    "HTTPS": true,
    "ID":    true,
    "IP":    true,
    "JSON":  true,
    "LHS":   true,
    "QPS":   true,
    "RAM":   true,
    "RHS":   true,
    "RPC":   true,
    "SLA":   true,
    "SMTP":  true,
    "SSH":   true,
    "TLS":   true,
    "TTL":   true,
    "UI":    true,
    "UID":   true,
    "UUID":  true,
    "URI":   true,
    "URL":   true,
    "UTF8":  true,
    "VM":    true,
    "XML":   true,
    "XSRF":  true,
    "XSS":   true,
}

LintGonicMapper is A GonicMapper that contains a list of common initialisms taken from golang/lint

func GetTableName Uses

func GetTableName(mapper Mapper, v reflect.Value) string

type CacheMapper Uses

type CacheMapper struct {
    // contains filtered or unexported fields
}

func NewCacheMapper Uses

func NewCacheMapper(mapper Mapper) *CacheMapper

func (*CacheMapper) Obj2Table Uses

func (m *CacheMapper) Obj2Table(o string) string

func (*CacheMapper) Table2Obj Uses

func (m *CacheMapper) Table2Obj(t string) string

type GonicMapper Uses

type GonicMapper map[string]bool

GonicMapper implements IMapper. It will consider initialisms when mapping names. E.g. id -> ID, user -> User and to table names: UserID -> user_id, MyUID -> my_uid

func (GonicMapper) Obj2Table Uses

func (mapper GonicMapper) Obj2Table(name string) string

func (GonicMapper) Table2Obj Uses

func (mapper GonicMapper) Table2Obj(name string) string

type Mapper Uses

type Mapper interface {
    Obj2Table(string) string
    Table2Obj(string) string
}

Mapper represents a name convertation between struct's fields name and table's column name

type PrefixMapper Uses

type PrefixMapper struct {
    Mapper Mapper
    Prefix string
}

PrefixMapper provides prefix table name support

func NewPrefixMapper Uses

func NewPrefixMapper(mapper Mapper, prefix string) PrefixMapper

func (PrefixMapper) Obj2Table Uses

func (mapper PrefixMapper) Obj2Table(name string) string

func (PrefixMapper) Table2Obj Uses

func (mapper PrefixMapper) Table2Obj(name string) string

type SameMapper Uses

type SameMapper struct {
}

SameMapper implements IMapper and provides same name between struct and database table

func (SameMapper) Obj2Table Uses

func (m SameMapper) Obj2Table(o string) string

func (SameMapper) Table2Obj Uses

func (m SameMapper) Table2Obj(t string) string

type SnakeMapper Uses

type SnakeMapper struct {
}

SnakeMapper implements IMapper and provides name transaltion between struct and database table

func (SnakeMapper) Obj2Table Uses

func (mapper SnakeMapper) Obj2Table(name string) string

func (SnakeMapper) Table2Obj Uses

func (mapper SnakeMapper) Table2Obj(name string) string

type SuffixMapper Uses

type SuffixMapper struct {
    Mapper Mapper
    Suffix string
}

SuffixMapper provides suffix table name support

func NewSuffixMapper Uses

func NewSuffixMapper(mapper Mapper, suffix string) SuffixMapper

func (SuffixMapper) Obj2Table Uses

func (mapper SuffixMapper) Obj2Table(name string) string

func (SuffixMapper) Table2Obj Uses

func (mapper SuffixMapper) Table2Obj(name string) string

type TableName Uses

type TableName interface {
    TableName() string
}

TableName table name interface to define customerize table name

Package names imports 4 packages (graph) and is imported by 20 packages. Updated 2020-09-17. Refresh now. Tools for package owners.