Skip to content

Commit 30ce3b5

Browse files
Delisa-samaEgor Dubin
authored andcommitted
Create README.md
1 parent 2b3a6e0 commit 30ce3b5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## This is a Proof of Concept for using the embed package in conjunction with sql-migrate.
2+
3+
## Example
4+
5+
``` go
6+
import (
7+
"embed"
8+
9+
embedmigrations "github.com/Delisa-sama/go-embed-migration-source"
10+
)
11+
12+
//go:embed migrations
13+
var migrationFiles embed.FS
14+
15+
// MigrationSource embedded migration source.
16+
var MigrationSource = &embedmigrations.EmbedFileSystemMigrationSource{
17+
FileSystem: migrationFiles,
18+
Dir: "migrations",
19+
}
20+
...
21+
num, err := sqlmigrate.ExecMax(
22+
db,
23+
dialect,
24+
MigrationSource,
25+
sqlmigrate.Up,
26+
limit,
27+
)
28+
if err != nil {
29+
return err
30+
}
31+
```

0 commit comments

Comments
 (0)