Giter Site home page Giter Site logo

dmgolembiowski / edgemorph-ext Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 20 KB

edgemorph-ext is an unofficial EdgeDB extension builder that is built on top of `pgx` by ZomboDB

Home Page: https://github.com/dmgolembiowski/edgemorph-ext

Rust 100.00%
edgedb postgresql-extension edgedb-extension rust cargo

edgemorph-ext's Introduction

Welcome to edgemorph-ext ๐Ÿ‘‹

Version Documentation License: Apache2

edgemorph-ext is an unofficial EdgeDB extension builder that is built on top of pgx

๐Ÿ  Homepage

Install

cargo install cargo-edmx

Usage

cargo edmx create my-edgedb-extension
cargo edmx build
cargo edmx save

Author

๐Ÿ‘ค David Golembiowski

Show your support

Give a โญ๏ธ if this project helped you!


This README was generated with โค๏ธ by readme-md-generator

edgemorph-ext's People

Contributors

dmgolembiowski avatar

Watchers

 avatar  avatar

edgemorph-ext's Issues

Reusable specification

Following the official Postgres documentation as well as the set-returning function example, prepare a modular basis or template that can match any EdgeDB base object as well as can be returned from any SDL function with the singature
-> T using ( ... ) alias to -> T using EdgeQL $$ ... $$.

In particular, there should be macro support for various kinds of custom types and their borrows:

// src/lib.rs

#[macro_export]
macro_rules! impl_trait_for_ref {
    (
        $( #[$attr:meta] )*
        $vis:vis trait $name:ident {
            $( $body:tt )*
        }
    ) => {
        impl<'f, F: $name + ?Sized> $name for &'f F {
            visit_members!( call_via_deref; $($body)* );
        }
    };
}

#[macro_export]
macro_rules! impl_trait_for_mut_ref {
    (
        $( #[$attr:meta] )*
        $vis:vis trait $name:ident {
            $( $body:tt )*
        }
    ) => {
        impl<'f, F: $name + ?Sized> $name for &'f mut F {
            visit_members!( call_via_deref; $($body)* );
        }
    };
}

as well as associated types like those who share an associated type:

macro_rules! impl_trait_for_boxed {
    (
        $( #[$attr:meta] )*
        $vis:vis trait $name:ident {
            $( $body:tt )*
        }
    ) => {
        impl<F: $name + ?Sized> $name for Box<F> {
            visit_members!( call_via_deref; $($body)* );
        }
    };
}

where visit_members is given by:

macro_rules! visit_members {
     (
         $callback:ident;

         $( #[$attr:meta] )*
         fn $name:ident(&self $(, $arg_name:ident : $arg_ty:ty )*) $(-> $ret:ty)?;

         $( $rest:tt )*
     ) => {
         $callback!(
             $( #[$attr] )*
             fn $name(&self $(, $arg_name : $arg_ty )*) $(-> $ret)?
         );

         visit_members! { $callback; $($rest)* }
     };
     (
         $callback:ident;

         $( #[$attr:meta] )*
         fn $name:ident(&mut self $(, $arg_name:ident : $arg_ty:ty )*) $(-> $ret:ty)?;

         $( $rest:tt )*
     ) => {
         $callback!(
             $( #[$attr] )*
             fn $name(&mut self $(, $arg_name : $arg_ty )*) $(-> $ret)?
         );

         visit_members! { $callback; $($rest)* }
     };
     ($callback:ident;) => {};
 }

For others, see https://adventures.michaelfbryan.com/posts/non-trivial-macros/

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.