chore(gonf): change Promise() methods return type to be more specific
This commit is contained in:
parent
e7572a1382
commit
14511b3201
8 changed files with 7 additions and 28 deletions
|
@ -43,7 +43,7 @@ func (c *CommandPromise) IfRepaired(p ...Promise) Promise {
|
|||
return c
|
||||
}
|
||||
|
||||
func (c *CommandPromise) Promise() Promise {
|
||||
func (c *CommandPromise) Promise() *CommandPromise {
|
||||
commands = append(commands, c)
|
||||
return c
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ func (c *CustomPromise) IfRepaired(p ...Promise) Promise {
|
|||
return c
|
||||
}
|
||||
|
||||
func (c *CustomPromise) Promise() Promise {
|
||||
func (c *CustomPromise) Promise() *CustomPromise {
|
||||
customPromises = append(customPromises, c)
|
||||
return c
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ func (f *FilePromise) IfRepaired(p ...Promise) Promise {
|
|||
return f
|
||||
}
|
||||
|
||||
func (f *FilePromise) Promise() Promise {
|
||||
func (f *FilePromise) Promise() *FilePromise {
|
||||
files = append(files, f)
|
||||
return f
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func (p *PackagePromise) IfRepaired(ps ...Promise) Promise {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *PackagePromise) Promise() Promise {
|
||||
func (p *PackagePromise) Promise() *PackagePromise {
|
||||
packages = append(packages, p)
|
||||
return p
|
||||
}
|
||||
|
|
|
@ -2,31 +2,10 @@ package gonf
|
|||
|
||||
type Promise interface {
|
||||
IfRepaired(...Promise) Promise
|
||||
Promise() Promise
|
||||
Resolve()
|
||||
Status() Status
|
||||
}
|
||||
|
||||
//type Operation int
|
||||
//
|
||||
//const (
|
||||
// AND = iota
|
||||
// OR
|
||||
// NOT
|
||||
//)
|
||||
//
|
||||
//func (o Operation) String() string {
|
||||
// switch o {
|
||||
// case AND:
|
||||
// return "and"
|
||||
// case OR:
|
||||
// return "or"
|
||||
// case NOT:
|
||||
// return "not"
|
||||
// }
|
||||
// panic("unknown")
|
||||
//}
|
||||
|
||||
type Status int
|
||||
|
||||
const (
|
||||
|
|
|
@ -42,7 +42,7 @@ func (s *ServicePromise) IfRepaired(p ...Promise) Promise {
|
|||
return s
|
||||
}
|
||||
|
||||
func (s *ServicePromise) Promise() Promise {
|
||||
func (s *ServicePromise) Promise() *ServicePromise {
|
||||
services = append(services, s)
|
||||
return s
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func (u *UserPromise) IfRepaired(p ...Promise) Promise {
|
|||
return u
|
||||
}
|
||||
|
||||
func (u *UserPromise) Promise() Promise {
|
||||
func (u *UserPromise) Promise() *UserPromise {
|
||||
users = append(users, u)
|
||||
return u
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func (b *BorgServer) IfRepaired(p ...gonf.Promise) gonf.Promise {
|
|||
return b
|
||||
}
|
||||
|
||||
func (b *BorgServer) Promise() gonf.Promise {
|
||||
func (b *BorgServer) Promise() *BorgServer {
|
||||
gonf.MakeCustomPromise(b).Promise()
|
||||
return b
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue