File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package plugin
22
33import (
44 "fmt"
5+ "strings"
56
67 ddbds "github.com/Vanssh-k/go-ds-dynamodb"
78 "github.com/aws/aws-sdk-go/aws"
@@ -71,6 +72,15 @@ func (c *DDBConfig) DiskSpec() fsrepo.DiskSpec {
7172 }
7273}
7374
75+ // Extracts the Sort Key from DSKey
76+ func extractSortKey (dsKey string ) (string , error ) {
77+ parts := strings .SplitN (dsKey , "/" , 3 )
78+ if len (parts ) < 3 {
79+ return "" , fmt .Errorf ("invalid DSKey format: %s" , dsKey )
80+ }
81+ return parts [2 ], nil
82+ }
83+
7484func (c * DDBConfig ) Create (path string ) (repo.Datastore , error ) {
7585 awsConfig := & aws.Config {
7686 Region : aws .String (c .Region ),
@@ -87,5 +97,12 @@ func (c *DDBConfig) Create(path string) (repo.Datastore, error) {
8797
8898 ddbClient := dynamodb .New (sess )
8999
90- return ddbds .New (ddbClient , c .Table ), nil
100+ ddbDS := ddbds .New (
101+ ddbClient ,
102+ c .Table ,
103+ ddbds .WithPartitionKey ("PartitionKey" ),
104+ ddbds .WithSortKey ("SortKey" ),
105+ )
106+
107+ return ddbDS , nil
91108}
You can’t perform that action at this time.
0 commit comments