Skip to content

Commit

Permalink
doc: prepare v0.8.0 (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
miyamo2 committed Jun 22, 2024
1 parent 35ea2bf commit 5ccb4f0
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .docs/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,58 @@ type User struct {
| gsi-sk | :\<index name\> | field will be the SK attribute of the specified Global Secondary Index.<br/>It works with `Migrator.CreateIndex()` |
| 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. |


## Create Table

```go
package main

import (
"github.com/miyamo2/dynmgrm"
"gorm.io/gorm"
)

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-sk:name-index"`
Note string `dynmgrm:"non-projective:[id_name-index,name-index]"`
}

func main() {
db, err := gorm.Open(dynmgrm.New())
if err != nil {
panic(err)
}

db.Migrator().CreateTable(&User{})
}
```

## Create GSI

```go
package main

import (
"github.com/miyamo2/dynmgrm"
"gorm.io/gorm"
)

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-sk:name-index"`
Note string `dynmgrm:"non-projective:[id_name-index,name-index]"`
}

func main() {
db, err := gorm.Open(dynmgrm.New())
if err != nil {
panic(err)
}

db.Migrator().CreateIndex(&User{}, "")
}
```
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.8.0 - 2024-06-22

✨ New Features

- GSI creation by `Migrator.CreateIndex` is now supported

## 0.7.0 - 2024-05-11

✨ New Features
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dynmgrm is the driver to issue PartiQL Statement to DynamoDB with GORM⚡
- [ ] With `REMOVE` clause
- [x] Delete
- [x] Create Table ※ proprietary PartiQL syntax by [`btnguyen2k/godynamo`](https://github.com/btnguyen2k/godynamo)
- [ ] Create Index ※ proprietary PartiQL syntax by [`btnguyen2k/godynamo`](https://github.com/btnguyen2k/godynamo)
- [x] Create GSI ※ proprietary PartiQL syntax by [`btnguyen2k/godynamo`](https://github.com/btnguyen2k/godynamo)

### Supports the following GORM features

Expand Down Expand Up @@ -77,7 +77,7 @@ dynmgrm is the driver to issue PartiQL Statement to DynamoDB with GORM⚡
- [ ] `GetTables`
- [ ] `HasColumn`
- [ ] `ColumnTypes`
- [ ] `CreateIndex`
- [x] `CreateIndex`
- [ ] `DropIndex`
- [ ] `HasIndex`

Expand Down

0 comments on commit 5ccb4f0

Please sign in to comment.