Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jackhallam/weightless-orm
🛸 A lightweight database mapping library
https://github.com/jackhallam/weightless-orm
database java java-orm mongo mongodb orm
Last synced: 4 days ago
JSON representation
🛸 A lightweight database mapping library
- Host: GitHub
- URL: https://github.com/jackhallam/weightless-orm
- Owner: jackhallam
- License: apache-2.0
- Created: 2020-12-12T12:54:49.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-26T15:25:55.000Z (about 1 year ago)
- Last Synced: 2023-08-26T16:35:27.302Z (about 1 year ago)
- Topics: database, java, java-orm, mongo, mongodb, orm
- Language: Java
- Homepage: https://weightlessorm.com
- Size: 331 KB
- Stars: 24
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Weightless is the lowest barrier-to-entry database mapping library for the JVM. Weightless currently supports [MongoDB](https://www.mongodb.com). Learn more at [weightlessorm.com](https://weightlessorm.com).
[![Github Code](https://img.shields.io/github/languages/top/jackhallam/weightless-orm?logo=github&logoColor=lightgrey)](https://github.com/jackhallam/weightless-orm)
[![Maven Central](https://img.shields.io/maven-central/v/com.jackhallam/weightless-orm?label=maven&logo=apache&logoColor=lightgrey)](https://search.maven.org/artifact/com.jackhallam/weightless-orm/0.1.0-beta/jar)
[![Travis CI Build Status](https://img.shields.io/travis/com/jackhallam/weightless-orm?logo=Travis-CI&logoColor=lightgrey)](https://travis-ci.com/jackhallam/weightless-orm)
[![Codacy Badge](https://img.shields.io/codacy/grade/87dafa74154349a0af3878b3435b0f98?logo=codacy&logoColor=lightgrey)](https://app.codacy.com/gh/jackhallam/weightless-orm?utm_source=github.com&utm_medium=referral&utm_content=jackhallam/weightless-orm&utm_campaign=Badge_Grade)
[![CodeFactor Code Quality](https://img.shields.io/codefactor/grade/github/jackhallam/weightless-orm?logo=codefactor&logoColor=lightgrey)](https://www.codefactor.io/repository/github/jackhallam/weightless-orm)
[![LGTM Code Quality](https://img.shields.io/lgtm/grade/java/github/jackhallam/weightless-orm?label=code%20quality&logo=lgtm&logoColor=lightgrey)](https://lgtm.com/projects/g/jackhallam/weightless-orm)
[![codecov](https://img.shields.io/codecov/c/gh/jackhallam/weightless-orm?logo=codecov&logoColor=lightgrey&token=LP3NP6IVS6)](https://codecov.io/gh/jackhallam/weightless-orm)
[![Gitter](https://img.shields.io/gitter/room/jackhallam/weightless-orm?color=%234fb999&logo=gitter&logoColor=lightgrey)](https://gitter.im/weightless-orm/weightless-orm)## Getting Started
Suppose we have a `Person` object we want to store in a Mongo database.
```java
class Person {
String name;
int age;
}
```
With the Weightless library, the next class we will create is a `PersonAccess` interface. Note the method level and parameter level annotations.
```java
interface PersonAccess {
@Create
void create(Person person);
@Find
Person findByName(@Field("name") @Equals String name);
}
```
Wait! We never have to implement this interface! Weightless has enough information to implement this class for us at runtime.
```java
Weightless weightless = Weightless.mongo("mongodb://localhost:27017").database("mydatabase").build(); // Connect to a local MongoDB instance
PersonAccess personAccess = weightless.get(PersonAccess.class); // PersonAccess is implemented for us herePerson james = new Person("James", 30);
personAccess.create(james);personAccess.findByName("James"); // { "name": "James", "age": 30 }
```## Installation
Install with [maven](https://search.maven.org/artifact/com.jackhallam/weightless-orm/0.1.0-beta/jar):
```xmlcom.jackhallam
weightless-orm
0.1.1-beta```
## Is Weightless for Me?
Is Weightless a good fit for your project? Weightless is designed to help projects get connected to a database as quickly as possible. Weightless is highly opinionated; it gives developers fewer customization options, and in return it is extremely easy to use.That being said, Weightless does not lock you in. Off-boarding when your project is mature enough to need a highly customized solution is very simple. You can still use the same database, and you can move one database table or collection away from Weightless' control at a time as needed.
## Going Further
Visit [weightlessorm.com](https://weightlessorm.com) for a more information with live examples.