Skip to content

Commit

Permalink
implement TextMarshaler for ULID
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Molina committed Apr 3, 2017
1 parent 3f8cfaf commit 16459a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions model.go
Expand Up @@ -295,6 +295,10 @@ func (u *ULID) UnmarshalText(text []byte) (err error) {
return
}

func (id ULID) MarshalText() ([]byte, error) {
return []byte(id.String()), nil
}

// Value implements the Valuer interface.
func (id ULID) Value() (driver.Value, error) {
return uuid.UUID(id).Value()
Expand Down

0 comments on commit 16459a8

Please sign in to comment.