mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Upgrade xorm to v1.1.0 (#15869)
This commit is contained in:
5
vendor/xorm.io/xorm/schemas/pk.go
generated
vendored
5
vendor/xorm.io/xorm/schemas/pk.go
generated
vendored
@@ -11,13 +11,16 @@ import (
|
||||
"xorm.io/xorm/internal/utils"
|
||||
)
|
||||
|
||||
// PK represents primary key values
|
||||
type PK []interface{}
|
||||
|
||||
// NewPK creates primay keys
|
||||
func NewPK(pks ...interface{}) *PK {
|
||||
p := PK(pks)
|
||||
return &p
|
||||
}
|
||||
|
||||
// IsZero return true if primay keys are zero
|
||||
func (p *PK) IsZero() bool {
|
||||
for _, k := range *p {
|
||||
if utils.IsZero(k) {
|
||||
@@ -27,6 +30,7 @@ func (p *PK) IsZero() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ToString convert to SQL string
|
||||
func (p *PK) ToString() (string, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
enc := gob.NewEncoder(buf)
|
||||
@@ -34,6 +38,7 @@ func (p *PK) ToString() (string, error) {
|
||||
return buf.String(), err
|
||||
}
|
||||
|
||||
// FromString reads content to load primary keys
|
||||
func (p *PK) FromString(content string) error {
|
||||
dec := gob.NewDecoder(bytes.NewBufferString(content))
|
||||
err := dec.Decode(p)
|
||||
|
Reference in New Issue
Block a user