Git Product home page Git Product logo

miniorm-rs's People

Stargazers

 avatar

Watchers

 avatar

miniorm-rs's Issues

Extract a Crud trait from Store in prep for the REST Axum API

Implementing a REST axum router (#9) directly on top of Store is probably not a good idea. What if someone wants to use the use the Router on some other data structure that provides CRUD operations. One should be able to to that.

Rust's answer to that is to define a Crud trait that contains all of the necessary functions and build a router on any type that implements this trait.

support for mysql backend

Multiple issues to figure out to integrate the MySql backend:

  1. The placeholders syntax is different ? (supported by MySql and Sqlite) vs $i (supported by Sqlite and Postgres)
  2. MySql does not support RETURNING id in the create and update query. Sqlx has last_insert_id() method on MySqlQueryResult, unclear if this works for UPDATE queries. But that means that we need to use a Query, not a QueryAs so the Bind trait is notsuitable as is because it only allows to bind against QueryAs

support REST server using axum

Given a Store that implements all the necessary CRUD operations, one should be able to create an axum::Router that handles all of these operations over a REST API, provided of course the the entity type implemented serde::Serialize and serde::Deserialize.

  • GET / will list all entities,
  • POST / will create a new entity,
  • PUT / will update an existing entity,
  • DELETE / will delete all entities
  • GET /:id to retrieve one entity from the store
  • PUT /:id to update one entity in the store
  • PATCH /:id to update one entity in the store - PATH or PUT or both?
  • DELETE /:id to delete one entity from the store

The main issue here is that on top of having to serialize/deserialize the entities, we also need a way to pack the id returned by the database. Introducing a wrapper type WithId<E,I> { inner: E, id: I } might be a good option here.

improve documentation

  • The documentation of miniorm_macros is lacking
  • Feature flags are not properly documented
  • and more...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.