1
1
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:
Lunny Xiao
2021-05-15 03:17:06 +08:00
committed by GitHub
parent e2f39c2b64
commit f6be429781
55 changed files with 1309 additions and 438 deletions

5
vendor/xorm.io/xorm/schemas/pk.go generated vendored
View File

@@ -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)