feat: cargo unload challenge
This commit is contained in:
@@ -16,11 +16,11 @@ func (o *Order) UnmarshalBinary(data []byte) error {
|
||||
return json.Unmarshal(data, o)
|
||||
}
|
||||
|
||||
func AsCommand[E DecodableCommand](c DecodableCommand) (E, bool) {
|
||||
func AsCommand[E DecodableCommand](c DecodableCommand) (result E, ok bool) {
|
||||
if v, ok := c.(E); ok {
|
||||
return v, true
|
||||
}
|
||||
return *new(E), false
|
||||
return
|
||||
}
|
||||
|
||||
type CommandType string
|
||||
@@ -56,6 +56,7 @@ func (ct CommandType) String() string {
|
||||
}
|
||||
|
||||
type DecodableCommand interface {
|
||||
CommandID() string
|
||||
CommandType() CommandType
|
||||
}
|
||||
|
||||
@@ -70,6 +71,10 @@ func (cm CommandMeta) CommandType() CommandType {
|
||||
return cm.CmdType
|
||||
}
|
||||
|
||||
func (cm CommandMeta) CommandID() string {
|
||||
return cm.CmdID
|
||||
}
|
||||
|
||||
func (cm *CommandMeta) Result(errCode int) {
|
||||
cm.CmdErrCode = &errCode
|
||||
cm.CmdApplied = new(bool(errCode == 0))
|
||||
|
||||
Reference in New Issue
Block a user