Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
/ kotlin-datastore Public archive

high-level kotlin library for accessing Google cloud datastore

License

Notifications You must be signed in to change notification settings

Khan/kotlin-datastore

Repository files navigation

kotlin-datastore

A high-level library for accessing Google cloud datastore from kotlin / jvm.

Datastore models are represented as plain data classes. Datastore access goes through a global singleton object DB. The general design is heavily influenced by the python db and ndb datastore client libraries.

Work-in-progress library documentation

This project is organized into two subprojects (which are packaged into independent artifacts):

  1. schema-metadata This contains annotations and types for defining datastore models as kotlin data classes. Everything in here is independent of the Google cloud client libraries and could be used for expressing schemas for other databases as well.

  2. google-cloud-datastore Code for using data classes defined within the schema-metadata package as Google cloud datastore entities. Also contains a default test stub.

Status

This is currently mostly feature complete and is being used in production, but we're still numbering releases as pre-1.0 for now to allow some greater flexibility for iterating on the public API as we start to use it more.

Functionality planned prior to a first release:

  • Datastore get-by-key
  • Transactions
  • Asynchronous operation (via kotlin coroutines)
  • Datastore queries (via a Map-like interface)
  • Datastore writes
  • multi-get and -put
  • Use of plain kotlin data classes to represent datstore models
  • Reflective implementation of converting Google datastore client Entitys to data class instances
  • Reflective implementation of converting data class instances to Google datastore client Entitys
  • Annotations for assigning a different in-datastore name to a property
  • Annotations for choosing whether to index a property
  • Primitive, nonrepeated properties
  • Repeated properties
  • Nested entity properties
  • Timestamp properties
  • Key properties
  • Location properties
  • Json properties
  • Computed properties
  • Other miscellaneous property types (in general we plan to support equivalents of the standard ndb property types at https://cloud.google.com/appengine/docs/standard/python/ndb/entity-property-reference#properties_and_value_types)
  • Backend using the google-cloud-java datastore client
  • Test stub backend

Functionality planned after a first release:

  • Independent transaction propagation mode
  • Nontransactional context to escape from an ongoing transaction
  • Annotation-processor-based generation of nonreflective converters to/from Entity
  • Annotation-processor-based typed query builders
  • Generation of bigquery schemas from model data classes

License

MIT, see LICENSE file.