Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(source): add scylladb connection #38

Merged
merged 15 commits into from
Dec 21, 2023

Conversation

j3yzz
Copy link
Contributor

@j3yzz j3yzz commented Dec 15, 2023

No description provided.

j3yzz and others added 8 commits December 5, 2023 17:30
Add ScyllaDB connection and QueryBuilder
- Added package documentation for scylladb package in sessionx.go, initializedb/init.go, table.go, initializedb/db.go, and querybuilder.go.
- Added usage examples and descriptions for each package in the documentation.
- Updated function and struct names to follow conventional naming.
- Removed unnecessary comments and print statements.

Closes feature/source-repository
…1941-9d821ace8654

- Updated golang.org/x/sys dependency to v0.0.0-20211019181941-9d821ace8654.
- Added new hash: id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=

Issue: #feature/source-repository
Add a new function called CreateKeySpace to the db package in the
ScyllaDB initialization module. This function creates a keyspace with
the given name using the provided session and executes a CQL statement
to create the keyspace if it doesn't already exist. The replication
strategy used is 'SimpleStrategy' with a replication factor of 1.

Issue: #feature/source-repository
feat(db): add CreateKeySpace function

Add a new function called CreateKeySpace to the db package in the
ScyllaDB initialization module. This function creates a keyspace with
the given name using the provided session and executes a CQL statement
to create the keyspace if it doesn't already exist. The replication
strategy used is 'SimpleStrategy' with a replication factor of 1.

Issue: #feature/source-repository

feat(go.sum): update golang.org/x/sys dependency to v0.0.0-20211019181941-9d821ace8654

- Updated golang.org/x/sys dependency to v0.0.0-20211019181941-9d821ace8654.
- Added new hash: id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=

Issue: #feature/source-repository

feat(scylladb): Add package documentation for scylladb package

- Added package documentation for scylladb package in sessionx.go, initializedb/init.go, table.go, initializedb/db.go, and querybuilder.go.
- Added usage examples and descriptions for each package in the documentation.
- Updated function and struct names to follow conventional naming.
- Removed unnecessary comments and print statements.

Closes feature/source-repository

feat(scylladb): add ScyllaDB infrastructure

Add ScyllaDB connection and QueryBuilder
@taha-ahmadi
Copy link
Member

@gohossein @AbtinSetyani please review this merge request

@j3yzz
Copy link
Contributor Author

j3yzz commented Dec 19, 2023

@gohossein @AbtinSetyani please review this merge request

Before the PR is merged, it is necessary for this folder structure to undergo a change. I will make these changes as soon as possible.

@taha-ahmadi
Copy link
Member

@j3yzz please fix conflicts

@j3yzz j3yzz merged commit 23b1e41 into ormushq:main Dec 21, 2023
2 checks passed

Note: Make sure to handle errors appropriately when using this package.
*/
package initializedb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move initialize file to source/adapter/scylladb package or rename this package to something like scyllainitialize.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The things you mentioned were added in this PR.
#42

}

const (
timeoutCluster = 5 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create Config struct for scylla and move this const to the struct. You can use this const as fallback(default) value.

Max: maxRetryDelay,
}
cluster.PoolConfig.HostSelectionPolicy = gocql.TokenAwareHostPolicy(gocql.RoundRobinHostPolicy())
log.Println("cluster was created.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove redundant logs or at least use slog.Debug (the logger package in ormus codebase).

return cluster
}

func (conn *ScyllaDBConnection) createKeyspace(session scylladb.SessionxInterface, keyspace string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove createKeyspace method.

)

type ScyllaDBConnection struct {
consistency gocql.Consistency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this fields to config struct

}

func (m *Manager) Run() error {
sourceDriver, err := iofs.New(os.DirFS(m.dir), "migrations")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can embed migration folder to binary please add embed statement to migration code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants