You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+6-12Lines changed: 6 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Contributing to CONTRIBUTING.md
1
+
# Contributing to Canyon-SQL
2
2
3
-
First off, thanks for taking the time to contribute!
3
+
First off, thanks for taking the time to contribute!
4
4
5
5
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions.
6
6
@@ -24,15 +24,13 @@ All types of contributions are encouraged and valued. See the [Table of Contents
24
24
-[Commit Messages](#commit-messages)
25
25
-[Join The Project Team](#join-the-project-team)
26
26
27
-
28
27
## Code of Conduct
29
28
30
29
This project and everyone participating in it is governed by the
31
30
[CONTRIBUTING.md Code of Conduct](blob/master/CODE_OF_CONDUCT.md).
32
31
By participating, you are expected to uphold this code. Please report unacceptable behavior
33
32
to <>.
34
33
35
-
36
34
## I Have a Question
37
35
38
36
> If you want to ask a question, we assume that you have read the available [Documentation](https://github.com/zerodaycode/canyon-book).
@@ -47,16 +45,14 @@ If you then still feel the need to ask a question and need clarification, we rec
47
45
48
46
We will then take care of the issue as soon as possible.
49
47
50
-
51
-
52
48
## I Want To Contribute
53
49
54
-
> ### Legal Notice
50
+
### Legal Notice
51
+
55
52
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
56
53
57
54
### Reporting Bugs
58
55
59
-
60
56
#### Before Submitting a Bug Report
61
57
62
58
A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
@@ -72,12 +68,10 @@ A good bug report shouldn't leave others needing to chase you up for more inform
72
68
- Possibly your input and the output
73
69
- Can you reliably reproduce the issue? And can you also reproduce it with older versions?
74
70
75
-
76
71
#### How Do I Submit a Good Bug Report?
77
72
78
73
> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>.
79
74
80
-
81
75
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
82
76
83
77
- Open an [Issue](/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
@@ -93,7 +87,7 @@ Once it's filed:
93
87
94
88
### Suggesting Enhancements
95
89
96
-
If you want to suggest an enhacement or new feature for the project, please [open a new issue](/issues) describing what you desire to improve, and, potentially, how you plan to contribute to the project.
90
+
If you want to suggest an enhancement or new feature for the project, please [open a new issue](/issues) describing what you desire to improve, and, potentially, how you plan to contribute to the project.
97
91
98
92
#### Before Submitting an Enhancement
99
93
@@ -112,6 +106,6 @@ Enhancement suggestions are tracked as [GitHub issues](/issues).
112
106
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
113
107
-**Explain why this enhancement would be useful** to most CONTRIBUTING.md users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
114
108
115
-
116
109
## Attribution
110
+
117
111
This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)!
-[](https://github.com/zerodaycode/Canyon-SQL/actions/workflows/macos-tests.yml)
8
9
-[](https://github.com/zerodaycode/Canyon-SQL/actions/workflows/windows-tests.yml)
9
10
@@ -27,8 +28,8 @@ You can read it [by clicking this link](https://zerodaycode.github.io/canyon-boo
27
28
- Use of multiple datasources. You can query multiple databases at the same time, even different ones!. This means that you will be able to query concurrently
28
29
a `PostgreSQL` database and an `SqlServer` one in the same project.
29
30
- Is macro based. With a few annotations and a configuration file, you are ready to write your data access.
30
-
- Allows **migrations**. `Canyon-SQL` comes with a *god-mode* that will manage every table on your database for you. You can modify in `Canyon` code your tables internally, altering columns, setting up constraints...
31
-
Also, in the future, we have plans to allow you to manipulate the whole server, like creating databases, altering configurations... everything, but in a programatically approach with `Canyon`!
31
+
- Allows **migrations**. `Canyon-SQL` comes with a *god-mode* that will manage every table on your database for you. You can modify in `Canyon` code your tables internally, altering columns, setting up constraints...
32
+
Also, in the future, we have plans to allow you to manipulate the whole server, like creating databases, altering configurations... everything, but in a programmatically approach with `Canyon`!
32
33
33
34
## Supported databases
34
35
@@ -40,3 +41,93 @@ Also, in the future, we have plans to allow you to manipulate the whole server,
40
41
Every crate listed above is an `async` based crate, in line with the guidelines of the `Canyon-SQL` design.
41
42
42
43
There are plans for include more databases engines.
44
+
45
+
## Better by example
46
+
47
+
Let's take a look to see how the `Canyon` code looks like!
Note the leading reference on the `find_by_pk(...)` parameter. This associated function receives an `&dyn QueryParameter<'_>` as argument, not a value.
80
+
81
+
### Building more complex queries
82
+
83
+
For exemplify the capabilities of `Canyon`, we will use `SelectQueryBuilder<T>`, which implements the `QueryBuilder<T>` trait
84
+
for build a more complex where, filteing data and joining tables.
// NOTE: We don't have in the docker the generated relationships
95
+
// with the joins, so for now, we are just going to check that the
96
+
// generated SQL by the SelectQueryBuilder<T> is the spected
97
+
assert_eq!(
98
+
select_with_joins.read_sql(),
99
+
"SELECT * FROM league INNER JOIN tournament ON league.id = tournament.league_id LEFT JOIN team ON tournament.id = player.tournament_id WHERE id > $1 AND name = $2 AND name IN ($2, $3) "
100
+
)
101
+
```
102
+
103
+
> Note: For now, when you use joins, you will need to create a new model with the columns in both tables (in case that you desire the data in such columns), but just follows the habitual process with the CanyonMapper.
104
+
It will try to retrieve the data for every field declared. If you don't declare a field that is in the open clause, in this case (*), that field won't be retrieved. No problem. But if you have fields that aren't map
105
+
able with some column in the database, the program will panic.
106
+
107
+
## More examples
108
+
109
+
If you want to see more examples, you can take a look into the `tests` folder, at the root of this repository. Every available database operation is tested there, so you can use it to find the usage of the described operations in the documentation mentioned above
110
+
111
+
## Contributing to CANYON-SQL
112
+
113
+
First of all, thanks for take in consideration help us with the project.
114
+
You can take a look to our [templated guide]((./CONTRIBUTING.md)).
115
+
116
+
But, to summarize:
117
+
118
+
- Take a look at the already opened issues, to see if already exists of it's someone already taking care about solving it. Even tho, you can enter to participate and explain your point of view, or even help to accomplish the task
119
+
- Make a fork of `Canyon-SQL`
120
+
- If you opened an issue, create a branch from the base branch of the repo (that's the default), and point it to your fork
121
+
- After complete your changes, open a `PR` to the default branch. Fill the template provided in the best way you're able to do it
122
+
- Wait for the approval. In most of cases, a test over the feature will be required before approve your changes
123
+
124
+
## What about the tests?
125
+
126
+
Typically in `Canyon`, isolated unit tests are written as doc-tests, and the integration ones are under the folder `./tests`
127
+
128
+
If you want to run the tests (because this is the first thing that you want to do after fork the repo), a couple of things have to be considered before.
129
+
130
+
- You will need Docker installed in the target machine
131
+
- If you have Docker, and `Canyon-SQL` cloned of forked, you can run our docker-compose file `(docker/docker-compose.yml)`, which will initialize a `PostgreSQL` database and will put content on it to make the tests able to work.
132
+
- Finally, some tests runs against `MSSQL`. We didn't found a nice way of inserting data directly when the Docker wakes up, but instead, we run a very special test located at `tests/crud/mod.rs`, that is named `initialize_sql_server_docker_instance`. When you run this one, initial data will be inserted into the tables that are created when this test run.
133
+
(If you know a better way of doing this, please, open a issue to let us know it, and improve this process!)
0 commit comments