Coder Social home page Coder Social logo

gen_data's Introduction

gen_data

根据excel文件内容生成erl文件

Build

$ rebar3 escriptize

使用说明

使用mustache模板类型

构建自定义的解析生成模块,例如:

-module(Module).

-gen_data(true). % 用于标识属于数据生成模块

-export([init/0, translate/1]). % 回调函数

init() ->
    {ok, #{
        source => "path/to/source_file",
        template => "path/to/priv/template_file",
        data => "path/to/gen_file"
    }}.

%% 输入的是包含 {数据页名称(二进制), 数据列表(使用第一行数据作为map的关键字)} 的列表
translate(Sheets) ->
    do_translate(Sheets, #{}).

do_translate([{<<"test">>, Info}|T], Res) ->
    do_translate(T, Res#{"tt" => Info});
do_translate([_|T], Res) ->
    do_translate(T, Res);
do_translate([], Res) ->
    Res.

使用gen_data脚本生成预期文件

gen_data's People

Contributors

ngqlaw avatar

Watchers

James Cloos avatar  avatar

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.