Go: Scaffolding database migrations

As we prepared the database migration files and embedded them into the db package, we are now left to implement the details required to process these migrations. Let’s start with extending the FS type, to actually provide functionality for reading them.

// ReadFile returns decoded file contents from FS func (fs FS) ReadFile(filename string) ([]byte, error) { if val, ok := fs[filename]; ok { return base64.StdEncoding.DecodeString(val) } return nil, os.ErrNotExist }

Reading a file from...

 •  0 comments  •  flag
Share on Twitter
Published on December 07, 2019 14:00
No comments have been added yet.