Giter VIP home page Giter VIP logo

Comments (4)

yanghuan avatar yanghuan commented on July 17, 2024

excel 的结构每一行是一行数据,导出时自然就是一个数组的结构,如果有一列是主键的话,可以在读取导出配置时,将数组映射到字典,proton 只是一个导出工作,不涉及这部分工作。这部分工作可以在自动生成读取的代码框架中处理。

‘’‘
在自动生成的配置读取代码的框架中可通过继承的方式在派生类中进行检查、关联、重组织表结构等,具体可参考CSharpGeneratorForProton
’‘’
https://github.com/yanghuan/CSharpGeneratorForProton

from proton.

gkjolin avatar gkjolin commented on July 17, 2024

def newline(count):
return '\n' + ' ' * count

if isinstance(obj, int) or isinstance(obj, float) or isinstance(obj, str):
yield json.dumps(obj, ensure_ascii = False)
else:
indent += 1
yield '{'
islist = isinstance(obj, list)
isfirst = True
for i in obj:
if isfirst:
isfirst = False
else:
yield ','
yield newline(indent)
if not islist:
k = i
i = obj[k]
yield k
yield ' = '
for part in tolua(i, indent):
yield part
indent -= 1
yield newline(indent)
yield '}' 在生成lua的时候 貌似是从这里生成的! 我在/CSharpGeneratorForProton没有发现有生成的相关内容呀!

from proton.

gkjolin avatar gkjolin commented on July 17, 2024

你能不能提供一个!lua的话 加入不提供设置主键的话 有的时候还是很有局限性的

from proton.

yanghuan avatar yanghuan commented on July 17, 2024

在导出工具中提供这个功能是不合理的,这个是需要在读取时,自己做结构变换,将数组变换成字典,我项目中读取lua 时这么处理
“”“
local array = LoadTemplate("HerosTemplate")
HerosConf = TemplateToConfTable(array, function (i)
return i.Id
end)
”“”
你可能还需要进行检查、关联、重组织表结构,这些功能不适合在导出工具中提供,都需要你你在读取时
自行处理,很多导出工具处理了这部分的功能,结果变得臃肿和难以使用,这是有仔细考量的,希望你能理解~~

from proton.

Related Issues (13)

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.