monalisa-service

Very simple database service

License

License

GroupId

GroupId

com.tsc9526
ArtifactId

ArtifactId

monalisa-service
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

monalisa-service
Very simple database service
Project URL

Project URL

https://github.com/11039850/monalisa-service
Project Organization

Project Organization

zzg
Source Code Management

Source Code Management

https://github.com/11039850/monalisa-service.git

Download monalisa-service

How to add to project

<!-- https://jarcasting.com/artifacts/com.tsc9526/monalisa-service/ -->
<dependency>
    <groupId>com.tsc9526</groupId>
    <artifactId>monalisa-service</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.tsc9526/monalisa-service/
implementation 'com.tsc9526:monalisa-service:2.0.0'
// https://jarcasting.com/artifacts/com.tsc9526/monalisa-service/
implementation ("com.tsc9526:monalisa-service:2.0.0")
'com.tsc9526:monalisa-service:jar:2.0.0'
<dependency org="com.tsc9526" name="monalisa-service" rev="2.0.0">
  <artifact name="monalisa-service" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tsc9526', module='monalisa-service', version='2.0.0')
)
libraryDependencies += "com.tsc9526" % "monalisa-service" % "2.0.0"
[com.tsc9526/monalisa-service "2.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.tsc9526 : monalisa-orm jar 2.0.0

provided (2)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0
org.mockito : mockito-all jar 1.8.5

test (4)

Group / Artifact Type Version
org.testng : testng jar 6.9.9
org.springframework : spring-test jar 4.3.2.RELEASE
org.springframework : spring-web jar 4.3.2.RELEASE
log4j : log4j jar 1.2.16

Project Modules

There are no modules declared in this project.

monalisa-service

Simple database http serivce.

image

Step 1: Write an interface or class

    @DB(url="jdbc:mysql://127.0.0.1:3306/test" ,username="root", password="root", 
        dbs="testdb", dbsAuthUsers="none")
    public interface TestDB {
    	public static DBConfig DB=DBConfig.fromClass(TestDB.class); 
    }

Step 2: Start web server

Step 3: Access database as following

Get all tables:

  curl -X HEAD http://localhost:8080/your_web_app/dbs/testdb

OR (Use parameter: method=HEAD )

  curl http://localhost:8080/your_web_app/dbs/testdb?method=HEAD

Get table metadata:

  curl -X HEAD http://localhost:8080/your_web_app/dbs/testdb/your_table_name

Select:

  curl http://localhost:8080/your_web_app/dbs/testdb/your_table_name

OR (Select multi-tables), click here for more query parameters.

  curl http://localhost:8080/your_web_app/dbs/testdb/table1,table2/table1.id=table2.id

Insert:

  curl -X POST -d "name=zzg&password=123456" http://localhost:8080/your_web_app/dbs/testdb/your_table_name

OR (Insert multi-tables)

  curl -X POST -d "table1.name=zzg&table2.name=xxx" http://localhost:8080/your_web_app/dbs/testdb/table1,table2

Update:

  curl -X PUT -d "name=zzg&password=1" http://localhost:8080/your_web_app/dbs/testdb/your_table_name/id

OR (Update by multi-keys)

  curl -X PUT -d "name=zzg&password=1" http://localhost:8080/your_web_app/dbs/testdb/your_table_name/id1=1,id2=2

Delete:

  curl -X DELETE http://localhost:8080/your_web_app/dbs/testdb/your_table_name/id

OR (Delete by multi-keys)

  curl -X DELETE http://localhost:8080/your_web_app/dbs/testdb/your_table_name/id1=1,id2=2

Maven:

	<dependency>
		<groupId>com.tsc9526</groupId>
		<artifactId>monalisa-service</artifactId>
		<version>2.0.0</version>
	</dependency>

Versions

Version
2.0.0