mirror of
https://github.com/diamondburned/cchat.git
synced 2025-07-12 23:16:10 +00:00
This commit adds a new package repository containing every single cchat types that the package provides. Its goal is to be the source of truth for the cchat files to be generated from. A huge advantage of this is having types in an easily representable format. This means that other languages can easily parse the repository and generate its own types that are similar to the original ones. Having a repository also allows easier code generation. For example, this commit will allow generating the "empty" package in the future, which would contain empty implementations of cchat databases that would return nil for asserter methods.
18 lines
324 B
Go
18 lines
324 B
Go
package repository
|
|
|
|
type ErrorType struct {
|
|
Struct
|
|
ErrorString TmplString // used for Error()
|
|
}
|
|
|
|
// Wrapped returns true if the error struct contains a field with the error
|
|
// type.
|
|
func (t ErrorType) Wrapped() bool {
|
|
for _, ret := range t.Struct.Fields {
|
|
if ret.Type == "error" {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|