resources: Specify defaults for the MetaParams
When creating new resources, we didn't specify the defaults, which for the limit metaparam caused invalid resources by default. It would be nice to change the limit param to have the 1/X (reciprocal) as the default, although the problem with that is that (1) it is illogical, and (2) it's not clear if the precision for the common cases is enough. If someone wants to investigate this further, please do! Zero value structs are definitely more useful! In any case, we can now specify the default. It's not entirely obvious to me if this is the best way to do it, or if there is a superior method.
This commit is contained in:
@@ -54,7 +54,11 @@ type MsgUID struct {
|
||||
|
||||
// Default returns some sensible defaults for this resource.
|
||||
func (obj *MsgRes) Default() Res {
|
||||
return &MsgRes{}
|
||||
return &MsgRes{
|
||||
BaseRes: BaseRes{
|
||||
MetaParams: DefaultMetaParams, // force a default
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Validate the params that are passed to MsgRes.
|
||||
|
||||
Reference in New Issue
Block a user