feat: cargo unload challenge

This commit is contained in:
Ilia Denisov
2026-02-21 09:57:02 +02:00
parent 233c9ebc2a
commit 9e36d7151e
12 changed files with 137 additions and 166 deletions
+7 -2
View File
@@ -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))