Skip to content

splix/garfa

Repository files navigation

Garfa

Build Status

Garfa - Groovy ActiveRecord for Google Appengine

  • for Groovy project
  • for Google Appengine
  • based on Objectify

Garfa extends you Groovy class with methods for querying, storing, updating you Google Appengine Datastore.

Latest stable version: 0.7

Docs: http://splix.github.io/garfa/

Examples

//get by id or key
Long id = 1
Car car = Car.get(id)

Key<Car> carKey = car.key
Car car2 = Car.get(carKey)
assert car == car2

//save
car = new Car(
    brand: 'Ford',
    model: 'Mustang'
)
car.save()

//update (in transaction, with retry)
Car.update id, { Car curr ->
  //`curr` is a current object, loaded from DB
  curr.count++
}

Maven dependency

<dependency>
    <groupId>com.the6hours</groupId>
    <artifactId>garfa</artifactId>
    <version>0.7</version>
</dependency>
<repositories>
    <repository>
        <id>the6hours-release</id>
        <url>http://maven.the6hours.com/release</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>
</repositories>

How to use

Just init call it before app start, like:

ObjectifyFactory objectifyFactory = //... you have to init Objectify before Garfa
Garfa garfa = new Garfa()
garfa.register([ ... list of models ... ])
garfa.objectifyFactory = objectifyFactory

If you're using Spring Framework it could be called on beans initialization (a @Configuration class), or on afterPropertiesSet() for InitializingBean

Documentation

License

Licensed under the Apache License, Version 2.0

Author

Igor Artamonov, The 6 Hours

About

Garfa - Groovy ActiveRecord for Google Appengine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages