Skip to content

Commit 8d31b55

Browse files
committed
refactor code
1 parent b9e244a commit 8d31b55

File tree

5 files changed

+28
-29
lines changed

5 files changed

+28
-29
lines changed

ballerina/annotations.bal

+27-19
Original file line numberDiff line numberDiff line change
@@ -14,65 +14,73 @@
1414
// specific language governing permissions and limitations
1515
// under the License.
1616

17-
# Description.
18-
# This annotation is used to map an entity/field name to a database table/column name.
17+
# Maps an entity/field name to a database table/column name.
18+
#
1919
# + name - name of the table/column in the database
2020
public type MapConfig record {|
2121
string name;
2222
|};
2323

24+
# The Annotation used to specify the mapping of an entity/field to a database table/column.
2425
public annotation MapConfig Mapping on type, record field;
2526

26-
# Description.
27-
# This annotation is used to define an Index on a database column.
28-
# + name - name of the index in the database
29-
public type SQLIndex record {|
30-
string name;
27+
# Marks the entity field as an index field.
28+
#
29+
# + names - array of index names associated with the database column
30+
public type IndexConfig record {|
31+
string[]? names = ();
3132
|};
3233

33-
public annotation SQLIndex Index on record field;
34+
# The Annotation used to specify the index name associated with a database column.
35+
public annotation IndexConfig Index on record field;
3436

35-
public annotation SQLIndex UniqueIndex on record field;
37+
# The Annotation used to specify the unique index name associated with a database column.
38+
public annotation IndexConfig UniqueIndex on record field;
3639

37-
# Description.
38-
# This annotation is used to define a custom max length to a VARCHAR column.
40+
# Defines a string field as a VARCHAR column and defines its max length.
41+
#
3942
# + length - max length of the VARCHAR column
4043
public type VarCharConfig record {|
4144
int length = 191;
4245
|};
4346

44-
# Description.
45-
# This annotation is used to define a custom max length to a CHAR column.
47+
# Defines a string field as a CHAR column and defines its length.
48+
#
4649
# + length - length of the CHAR column
4750
public type CharConfig record {|
4851
int length = 10;
4952
|};
5053

54+
# The Annotation used to specify the max length of a VARCHAR column.
5155
public annotation VarCharConfig VarChar on record field;
5256

57+
# The Annotation used to specify the length of a CHAR column.
5358
public annotation CharConfig Char on record field;
5459

55-
# Description.
56-
# This annotation is used to define a custom precision to a DECIMAL column.
60+
# Defines a custom precision and scale to a DECIMAL column.
61+
#
5762
# + precision - precision of the DECIMAL column as an array of two integers [precision, scale]
5863
public type DecimalConfig record {|
5964
[int, int] precision = [65, 30];
6065
|};
6166

67+
# The Annotation used to specify a custom precision and scale of a DECIMAL column.
6268
public annotation DecimalConfig Decimal on record field;
6369

64-
# Description.
65-
# To specify your own foreign key column in the entity record.
70+
# Specifies your own foreign key column in the entity record.
71+
#
6672
# + refs - array of key fields in the entity
6773
public type RelationConfig record {|
6874
string[] refs;
6975
|};
7076

77+
# The Annotation used to specify the foreign key column in the entity record.
7178
public annotation RelationConfig Relation on record field;
7279

73-
# Description.
74-
# This annotation is used to denote an entity is auto_increment.
80+
# Denotes an entity field as a database generated value field.
81+
#
7582
public type GeneratedConfig record {|
7683
|};
7784

85+
# The Annotation used to specify a database generated column in the entity record.
7886
public annotation GeneratedConfig Generated on record field;

compiler-plugin/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ dependencies {
3434
implementation group: 'org.ballerinalang', name: 'toml-parser', version: "${ballerinaLangVersion}"
3535
implementation group: 'org.ballerinalang', name: 'formatter-core', version: "${ballerinaLangVersion}"
3636
implementation group: 'io.ballerina.stdlib', name: 'persist-native', version: "${stdlibPersistVersion}"
37-
implementation group: 'io.ballerina.stdlib', name: 'persist-compiler-plugin', version: "1.2.1-20240213-142100-0cfe196"
3837
}
3938

4039
def excludePattern = '**/module-info.java'

compiler-plugin/src/main/java/io/ballerina/stdlib/persist/sql/compiler/DiagnosticsCodes.java

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public enum DiagnosticsCodes {
4040
PERSIST_SQL_206("PERSIST_206", "the ''{0}'' clause cannot be defined by the array field " +
4141
"of the entity",
4242
ERROR);
43+
4344
private final String code;
4445
private final String message;
4546
private final DiagnosticSeverity severity;

compiler-plugin/src/main/java/io/ballerina/stdlib/persist/sql/compiler/utils/Utils.java

-7
This file was deleted.

compiler-plugin/src/main/java/module-info.java

-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@
2323
requires io.ballerina.toml;
2424
requires io.ballerina.formatter.core;
2525
requires io.ballerina.stdlib.persist;
26-
requires io.ballerina.stdlib.persist.plugin;
27-
exports io.ballerina.stdlib.persist.sql.compiler;
2826
}

0 commit comments

Comments
 (0)