mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
[F3] upgrade to gof3 50a6e740ac04
Add new methods GetIDString() & SetIDString() & ToFormatInterface()
Change the prototype of the fixture function
(cherry picked from commit d7b263ff8b
)
This commit is contained in:
parent
07412698e8
commit
b3eaf2249d
16 changed files with 154 additions and 4 deletions
|
@ -4,6 +4,7 @@ package driver
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
|
@ -26,10 +27,18 @@ func (o Topic) GetID() int64 {
|
|||
return o.ID
|
||||
}
|
||||
|
||||
func (o Topic) GetIDString() string {
|
||||
return fmt.Sprintf("%d", o.GetID())
|
||||
}
|
||||
|
||||
func (o *Topic) SetID(id int64) {
|
||||
o.ID = id
|
||||
}
|
||||
|
||||
func (o *Topic) SetIDString(id string) {
|
||||
o.SetID(util.ParseInt(id))
|
||||
}
|
||||
|
||||
func (o *Topic) IsNil() bool {
|
||||
return o.ID == 0
|
||||
}
|
||||
|
@ -38,6 +47,10 @@ func (o *Topic) Equals(other *Topic) bool {
|
|||
return o.Name == other.Name
|
||||
}
|
||||
|
||||
func (o *Topic) ToFormatInterface() format.Interface {
|
||||
return o.ToFormat()
|
||||
}
|
||||
|
||||
func (o *Topic) ToFormat() *format.Topic {
|
||||
return &format.Topic{
|
||||
Common: format.NewCommon(o.ID),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue