engine: resources: Add some compile time checks for groupers
These can "break" silently and not autogroup if we change the resource and it no longer fulfills the interface. Add this compile time check to prevent that.
This commit is contained in:
@@ -52,6 +52,8 @@ func init() {
|
|||||||
engine.RegisterResource(httpServerFileKind, func() engine.Res { return &HTTPServerFileRes{} })
|
engine.RegisterResource(httpServerFileKind, func() engine.Res { return &HTTPServerFileRes{} })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ HTTPServerGroupableRes = &HTTPServerFileRes{} // compile time check
|
||||||
|
|
||||||
// HTTPServerFileRes is a file that exists within an http server. The name is
|
// HTTPServerFileRes is a file that exists within an http server. The name is
|
||||||
// used as the public path of the file, unless the filename field is specified,
|
// used as the public path of the file, unless the filename field is specified,
|
||||||
// and in that case it is used instead. The way this works is that it autogroups
|
// and in that case it is used instead. The way this works is that it autogroups
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ func init() {
|
|||||||
engine.RegisterResource(httpServerFlagKind, func() engine.Res { return &HTTPServerFlagRes{} })
|
engine.RegisterResource(httpServerFlagKind, func() engine.Res { return &HTTPServerFlagRes{} })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ HTTPServerGroupableRes = &HTTPServerFlagRes{} // compile time check
|
||||||
|
|
||||||
// HTTPServerFlagRes is a special path that exists within an http server. The
|
// HTTPServerFlagRes is a special path that exists within an http server. The
|
||||||
// name is used as the public path of the flag, unless the path field is
|
// name is used as the public path of the flag, unless the path field is
|
||||||
// specified, and in that case it is used instead. The way this works is that it
|
// specified, and in that case it is used instead. The way this works is that it
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ func init() {
|
|||||||
engine.RegisterResource(httpServerProxyKind, func() engine.Res { return &HTTPServerProxyRes{} })
|
engine.RegisterResource(httpServerProxyKind, func() engine.Res { return &HTTPServerProxyRes{} })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ HTTPServerGroupableRes = &HTTPServerProxyRes{} // compile time check
|
||||||
|
|
||||||
// HTTPServerProxyRes is a resource representing a special path that exists
|
// HTTPServerProxyRes is a resource representing a special path that exists
|
||||||
// within an http server. The name is used as the public path of the endpoint,
|
// within an http server. The name is used as the public path of the endpoint,
|
||||||
// unless the path field is specified, and in that case it is used instead. The
|
// unless the path field is specified, and in that case it is used instead. The
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ func init() {
|
|||||||
engine.RegisterResource(httpServerUIKind, func() engine.Res { return &HTTPServerUIRes{} })
|
engine.RegisterResource(httpServerUIKind, func() engine.Res { return &HTTPServerUIRes{} })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ HTTPServerGroupableRes = &HTTPServerUIRes{} // compile time check
|
||||||
|
|
||||||
// HTTPServerUIGroupableRes is the interface that you must implement if you want
|
// HTTPServerUIGroupableRes is the interface that you must implement if you want
|
||||||
// to allow a resource the ability to be grouped into the http server ui
|
// to allow a resource the ability to be grouped into the http server ui
|
||||||
// resource. As an added safety, the Kind must also begin with
|
// resource. As an added safety, the Kind must also begin with
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ func init() {
|
|||||||
engine.RegisterResource(httpServerUIInputKind, func() engine.Res { return &HTTPServerUIInputRes{} })
|
engine.RegisterResource(httpServerUIInputKind, func() engine.Res { return &HTTPServerUIInputRes{} })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ HTTPServerUIGroupableRes = &HTTPServerUIInputRes{} // compile time check
|
||||||
|
|
||||||
// HTTPServerUIInputRes is a form element that exists within a http:server:ui
|
// HTTPServerUIInputRes is a form element that exists within a http:server:ui
|
||||||
// resource, which exists within an http server. The name is used as the unique
|
// resource, which exists within an http server. The name is used as the unique
|
||||||
// id of the field, unless the id field is specified, and in that case it is
|
// id of the field, unless the id field is specified, and in that case it is
|
||||||
|
|||||||
Reference in New Issue
Block a user