mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-05 00:40:24 +08:00
24 lines
401 B
Go
24 lines
401 B
Go
|
|
package sqlstmt
|
||
|
|
|
||
|
|
import "strings"
|
||
|
|
|
||
|
|
type IdentifierValue struct {
|
||
|
|
Value string
|
||
|
|
QuoteChar *QuoteChar
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewIdentifierValue(value string) *IdentifierValue {
|
||
|
|
value = strings.TrimPrefix(value, ".")
|
||
|
|
qc := GetQuoteChar(value)
|
||
|
|
if qc == NONE {
|
||
|
|
return &IdentifierValue{
|
||
|
|
Value: value,
|
||
|
|
QuoteChar: qc,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return &IdentifierValue{
|
||
|
|
Value: qc.Unwrap(value),
|
||
|
|
QuoteChar: qc,
|
||
|
|
}
|
||
|
|
}
|