Skip to content

Commit

Permalink
Add MustParseSchema function
Browse files Browse the repository at this point in the history
  • Loading branch information
spenczar committed Mar 23, 2015
1 parent 4e84c7b commit 5ec9eb1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,16 @@ func ParseSchema(rawSchema string) (Schema, error) {
return schemaByType(schema)
}

// MustParseSchema is like ParseSchema, but panics if the given schema
// cannot be parsed.
func MustParseSchema(rawSchema string) Schema {
s, err := ParseSchema(rawSchema)
if err != nil {
panic(err)
}
return s
}

func schemaByType(i interface{}) (Schema, error) {
switch v := i.(type) {
case nil:
Expand Down

0 comments on commit 5ec9eb1

Please sign in to comment.