Skip to content

Commit 16459a8

Browse files
author
Miguel Molina
committed
implement TextMarshaler for ULID
1 parent 3f8cfaf commit 16459a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

model.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ func (u *ULID) UnmarshalText(text []byte) (err error) {
295295
return
296296
}
297297

298+
func (id ULID) MarshalText() ([]byte, error) {
299+
return []byte(id.String()), nil
300+
}
301+
298302
// Value implements the Valuer interface.
299303
func (id ULID) Value() (driver.Value, error) {
300304
return uuid.UUID(id).Value()

0 commit comments

Comments
 (0)