Skip to content

Commit d80f545

Browse files
chinese readme
1 parent 9dac7b0 commit d80f545

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# What's KtOrm?
22

3-
KtOrm is a lightweight and efficient ORM Framework for Kotlin directly based on pure JDBC. It provides strong typed and flexiable SQL DSL and many convenient extension functions to reduce our duplication of effort. All the SQLs are generated automaticlly, of course.
3+
KtOrm is a lightweight and efficient ORM Framework for Kotlin directly based on pure JDBC. It provides strong typed and flexiable SQL DSL and many convenient extension functions to reduce our duplicated effort on database operations. All the SQLs are generated automaticlly, of course. For more documentation, go to our site: [https://ktorm.liuwj.me](https://ktorm.liuwj.me).
4+
5+
:us: English | :cn: [简体中文](README_cn.md)
46

57
[![Build Status](https://www.travis-ci.org/vincentlauvlwj/KtOrm.svg?branch=master)](https://www.travis-ci.org/vincentlauvlwj/KtOrm)
68
[![Maven Central](https://img.shields.io/maven-central/v/me.liuwj.ktorm/ktorm-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22me.liuwj.ktorm%22)
@@ -15,11 +17,11 @@ KtOrm is a lightweight and efficient ORM Framework for Kotlin directly based on
1517
- Strong typed SQL DSL, exposing low-level bugs at compile time.
1618
- Flexiable query, exactly control the generated SQLs as you wish.
1719
- Extensible design, write your own extensions to support more data types, SQL functions, etc.
18-
- Dialects supported, MySQL, Oracle, PostgreSQL, or you can write your own dialect by implementing the `SqlDialect` interface.
20+
- Dialects supports, MySQL, Oracle, PostgreSQL, or you can write your own dialect support by implementing the `SqlDialect` interface.
1921

2022
# Quick Start
2123

22-
KtOrm was deployed to maven central and jcenter, so you just need to a dependency to your `pom.xml` file if you are using maven:
24+
KtOrm was deployed to maven central and jcenter, so you just need to add a dependency to your `pom.xml` file if you are using maven:
2325

2426
````xml
2527
<dependency>
@@ -35,7 +37,7 @@ Or Gradle:
3537
compile "me.liuwj.ktorm:ktorm-core:${ktorm.version}"
3638
````
3739

38-
Then create a kotlin object to describe your table schema:
40+
Then create a Kotlin object to describe your table schema:
3941

4042
````kotlin
4143
object Employees : Table<Nothing>("t_employee") {

README_cn.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# KtOrm 是什么?
2+
3+
KtOrm 是一个直接基于纯 JDBC 编写的高效简洁的轻量级 Kotlin ORM 框架,它提供了强类型而且灵活的 SQL DSL(领域特定语言)和许多方便的扩展函数,以减少我们操作数据库的重复劳动。当然,所有的 SQL 都是自动生成的。查看更多详细文档,请前往官网:[https://ktorm.liuwj.me](https://ktorm.liuwj.me)
4+
5+
:cn: 简体中文 | :us: [English](README.md)
6+
7+
[![Build Status](https://www.travis-ci.org/vincentlauvlwj/KtOrm.svg?branch=master)](https://www.travis-ci.org/vincentlauvlwj/KtOrm)
8+
[![Maven Central](https://img.shields.io/maven-central/v/me.liuwj.ktorm/ktorm-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22me.liuwj.ktorm%22)
9+
[![Download](https://api.bintray.com/packages/vincentlauvlwj/maven/ktorm-core/images/download.svg)](https://bintray.com/vincentlauvlwj/maven)
10+
[![Apache License 2](https://img.shields.io/badge/license-Apache%202-blue.svg?maxAge=2592000)](LICENSE)
11+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2cf0d4b81c3546809ad2f83a795c34c2)](https://app.codacy.com/app/vincentlauvlwj/KtOrm?utm_source=github.com&utm_medium=referral&utm_content=vincentlauvlwj/KtOrm&utm_campaign=Badge_Grade_Dashboard)
12+
[![Author](https://img.shields.io/badge/author-vince-yellowgreen.svg)](https://www.liuwj.me)
13+
14+
# 特性
15+
16+
- 没有配置文件、没有 xml、轻量级、简洁易用
17+
- 强类型 SQL DSL,将低级 bug 暴露在编译器
18+
- 灵活的查询,随心所欲地精确控制所生成的 SQL
19+
- 易扩展的设计,可以灵活编写扩展,支持更多数据类型和 SQL 函数等
20+
- 方言支持,MySQL、Oracle、PostgreSQL,你也可以自己编写方言支持,只需要实现 `SqlDialect` 接口即可
21+
22+
# 快速开始
23+
24+
KtOrm 已经发布到 maven 中央仓库和 jcenter,因此,如果你使用 maven 的话,只需要在 `pom.xml` 文件里面添加一个依赖:
25+
26+
````xml
27+
<dependency>
28+
<groupId>me.liuwj.ktorm</groupId>
29+
<artifactId>ktorm-core</artifactId>
30+
<version>${ktorm.version}</version>
31+
</dependency>
32+
````
33+
34+
或者 gradle:
35+
36+
````groovy
37+
compile "me.liuwj.ktorm:ktorm-core:${ktorm.version}"
38+
````
39+
40+
然后,创建一个 Kotlin object,描述你的表结构:
41+
42+
````kotlin
43+
object Employees : Table<Nothing>("t_employee") {
44+
val id by int("id").primaryKey()
45+
val name by varchar("name")
46+
val job by varchar("job")
47+
val managerId by int("manager_id")
48+
val hireDate by date("hire_date")
49+
val salary by long("salary")
50+
val departmentId by int("department_id")
51+
}
52+
````
53+
54+
现在,可以编写代码连接数据库,执行一个简单的查询了:
55+
56+
````kotlin
57+
fun main() {
58+
Database.connect("jdbc:mysql://localhost:3306/ktorm", driver = "com.mysql.jdbc.Driver")
59+
60+
for (row in Employees.select()) {
61+
println(row[Employees.name])
62+
}
63+
}
64+
````
65+
66+
当你执行这个程序,KtOrm 就会生成一条 SQL `select * from t_employee`,查询表中所有的员工记录,然后打印出他们的名字。
67+

0 commit comments

Comments
 (0)