Skip to content

Commit

Permalink
Rename the key name of tag, dynmgrm:lsi to dynmgrm:lsi-sk (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
miyamo2 authored May 11, 2024
1 parent bb3212b commit 59aa5c0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .docs/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package main
type User struct {
ProjectID string `gorm:"primaryKey dynmgrm:"pk"`
ID string `gorm:"primaryKey dynmgrm:"sk;gsi-pk:id_name-index"`
Name string `dynmgrm:"gsi-sk:id_name-index;lsi:name-index"`
Name string `dynmgrm:"gsi-sk:id_name-index;lsi-sk:name-index"`
Note string `dynmgrm:"non-projective:[id_name-index,name-index]"`
}
```
Expand All @@ -21,5 +21,5 @@ type User struct {
| sk | - | field will be the SK attribute of the table. |
| gsi-pk | :\<index name\> | field will be the PK attribute of the specified Global Secondary Index.<br/>It works with `Migrator.CreateIndex()` |
| gsi-sk | :\<index name\> | field will be the SK attribute of the specified Global Secondary Index.<br/>It works with `Migrator.CreateIndex()` |
| lsi | :\<index name\> | field will be the SK attribute of the specified Local Secondary Index. |
| lsi-sk | :\<index name\> | field will be the SK attribute of the specified Local Secondary Index. |
| non-projective | :[(,)\<index name\>] | exclude from projection at enumerated Index. |
2 changes: 1 addition & 1 deletion migrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var (
type CreateTableATable struct {
PK string `dynmgrm:"pk"`
SK int `dynmgrm:"sk"`
LsiSK []byte `dynmgrm:"lsi:lsi_sk-index"`
LsiSK []byte `dynmgrm:"lsi-sk:lsi_sk-index"`
ProjectiveAttr1 string
ProjectiveAttr2 string
NonProjective string `dynmgrm:"non-projective:[lsi_sk-index]"`
Expand Down
2 changes: 1 addition & 1 deletion reflect_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func newDynmgrmTag(tag reflect.StructTag) dynmgrmTag {
Kind: secondaryIndexKindGSI,
}
res.IndexProperty = append(res.IndexProperty, iprp)
case "lsi":
case "lsi-sk":
iprp := secondaryIndexProperty{
Name: kv[1],
SK: true,
Expand Down
4 changes: 2 additions & 2 deletions reflect_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func Test_newDynmgrmTag(t *testing.T) {
B string `dynmgrm:"sk"`
C string `dynmgrm:"gsi-pk:c_d-index"`
D string `dynmgrm:"gsi-sk:c_d-index"`
E string `dynmgrm:"lsi:e-index"`
E string `dynmgrm:"lsi-sk:e-index"`
F string `dynmgrm:"non-projective:[c_d-index,e-index]"`
G string `dynmgrm:"pk;sk"`
H string `dynmgrm:"sk;pk"`
Expand Down Expand Up @@ -373,7 +373,7 @@ func Test_newDynmgrmTableDefine(t *testing.T) {
B string `dynmgrm:"sk"`
C string `dynmgrm:"gsi-pk:c_d-index"`
D string `dynmgrm:"gsi-sk:c_d-index"`
E string `dynmgrm:"lsi:e-index"`
E string `dynmgrm:"lsi-sk:e-index"`
F string `dynmgrm:"non-projective:[c_d-index,e-index]"`
}
type test struct {
Expand Down
2 changes: 1 addition & 1 deletion tests/create_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func Test_CreateTable(t *testing.T) {
type CreateTableTestWithLSITable struct {
PK string `dynmgrm:"pk"`
SK int `dynmgrm:"sk"`
Name string `dynmgrm:"lsi:pk-name-index"`
Name string `dynmgrm:"lsi-sk:pk-name-index"`
Projective string
NonProjective string `dynmgrm:"non-projective:[pk-name-index]"`
}
Expand Down

0 comments on commit 59aa5c0

Please sign in to comment.