uAdmin the Golang Web framework

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

A little over two years ago, I started looking for a web framework like Django for Golang but to my surprise, I couldn’t find anything that even does the basic. My requirements were simple:

  • A standard way of creating models and database schema migration
  • Some basic UI features like foreign key, static lists, inlines and some front-end validation
  • Auto generated UI that looks good enough for prototyping a concept and could be used for production.

I remembered at that point how Django was originally created where they were looking for something like Ruby on Rails for Python and they could not find so they created Django. So for the next 13 days I started writing a prototype under the code “eadmin” with the help of other developers doing UI, Golang reflection, database, … etc. We ended up with something that works. It didn’t have any of the cool features that Django has but it works and it was blazing fast. The most important feature that we got out of that is we had a way to quickly prototype an idea and ship it on a SCB (Single Board Computer) with an ARM CPU and 128–256 MB RAM.

Fast forward two years and our basic library is a developer’s wish list. Everyone on my team contributed code and found “a missing feature” from export to Excel to a built-in image cropping! This is too cool to stay as an in-house tool and we should open source it. I asked management if they are open to the idea and weirdly they didn’t mind it. Now I have to open source it but first I have to clean our code from all product specific code and replace it with generic features that could be used instead. We also decided to rename our library to uAdmin because the name was available on Github and none of us was clever enough to come up with something as cool as Django.

what is so special about uAdmin?

  • Blazing fast
  • Can run on minimum hardware requirements
  • Pretty good security features (bcrypt hashing, 2FA)
  • Clean and sharp UI
  • Defaults for everything! but don’t worry, you can override them

So let’s jump into some code

To install uAdmin:

go get github.com/uadmin/uadmin/...

now you can start your first project:

$ mkdir -p ~/go/src/github.com/your_name/todo
$ cd ~/go/src/github.com/your_name/todo
$ uadmin prepare

Running uadmin prepare will create a few new folders for you, templates, static, … etc. You don’t really have to worry about these for now. Let start writing code. Use any editor you like to create main.go and put this code in it.

package main
import ("github.com/uadmin/uadmin""time"
)
type Todo struct {uadmin.ModelName        stringDescription string `uadmin:"html"`TargetDate  time.TimeProgress    int `uadmin:"progress_bar"`
}
func main() {uadmin.Register(Todo{})uadmin.StartServer()
}

To run this:

go build; ./todo

It will create a database and migrate your model and create a few more “system” models for authentication, permissions … etc. You should be able to check your project now at http://0.0.0.0:8080/

You can login with username admin and password admin and you will get the dashboard:

 

You can see that your model TODO is already on your dashboard. Open that and add a task to your todo list:

That’s it. Congrats, you have built your first app with uAdmin. Now you have to know that everything in here is customizable a we will cover some more features in part 2 of this tutorial.

转载于:https://my.oschina.net/lemonwater/blog/2872892

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/281712.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ABP Vnext 数据库表字段存在IsDeleted如何物理删除HardDeleteAsync

ABP Vnext在写表实体会继承 xxxEntity : FullAuditedAggregateRoot<Guid>此时这个聚合根会包含一个 IsDeleted字段属性&#xff0c;一旦继承了这个软删除字段&#xff0c;你在仓储对象调用 await _xxxxRepository.DeleteAsync(x > x.Id > 0)时的时候&#xff0c;…

详解当当网的分布式作业框架elastic-job

详解当当网的分布式作业框架elastic-job

java条件触发,条件事件触发Anylogic

所以首先event.restart()函数仅在事件具有触发类型时才适用&#xff1a;timeout和mode&#xff1a;user control&#xff0c;否则你的event.restart()函数什么也不做......其次&#xff0c;你需要在有条件的事件上调用你的函数&#xff0c;但是在停车的那一刻......你可以在car…

攻城不易守城更难,汇付天下该如何守住打下来的“江山”?

伴随着相关监管政策的实施&#xff0c;第三方支付市场俨然已经迎来了“罚单潮”。根据不完全统计&#xff0c;截至2018年10月8日&#xff0c;央行已开出109张支付罚单&#xff0c;国付宝等多家支付机构罚金甚至高达千万以上&#xff0c;今年累计处罚的金额已超过2亿元。照此速度…

1024技术论坛 | C#与.NET技术新发展

主办方简介上海维宏电子科技股份有限公司&#xff08;维宏股份&#xff0c;股票代码&#xff1a;300508&#xff09;&#xff0c;是一家专业提供运动控制系统解决方案的高科技企业&#xff0c;公司拥有雄厚的研发力量和高素质的服务队伍&#xff0c;我们以快捷的速度&#xff0…

Oracle Code登录北京 代码盛宴邀你high起来|免费报名

盛夏北京&#xff0c;将迎来 Oracle Code 北京站活动。作为贯穿全年、横跨全球的 20 场活动中的一场&#xff0c;北京站汲取各地 Oracle Code 精华&#xff0c;结合国内开发者社区现状和需求&#xff0c;呈现一场代码盛宴。 来自 Oracle Code、OTN 及 AppsLap 的大咖们将齐聚北…

简单的四则运算

// 20163536 杨宇航 奖励原创 上课未完成原因&#xff1a; 哎&#xff0c;在上那节课时候&#xff0c;我们正在准备程序设计大赛&#xff0c;因为我们团队当中只有我的电脑有数据库&#xff0c;所有我只好将我的电脑贡献给团队了&#xff0c;不然在10分钟内完成应该不成问题&a…

导出导入数据库

一、导出用 mysqldump 备份数据库 1mysqldump -u用户 -p密码 数据库名 > &#xff08;目录&#xff09;导出文件名如&#xff1a;mysqldump -uroot -p123 dbname > /root/test.sql 回车就直接完成备份。如果只需要建表指令&#xff0c;则命令如下&#xff1a; shell> …

matlab randn 范围,请问randn产生的数据在什么范围内变化

产生均值为0&#xff0c;方差 σ^2 1&#xff0c;标准差σ 1的正态分布的随机数或矩阵的函数。Example:产生一个随机分布的指定均值和方差的矩阵&#xff1a;将randn产生的结果乘以标准差&#xff0c;然后加上期望均值即可。例如&#xff0c;产生均值为0.6&#xff0c;方差为…

C#开发串口通信实例及串口基础

一、串口通信简介串行接口&#xff08;串口&#xff09;是一种可以将接受来自CPU的并行数据字符转换为连续的串行数据流发送出去&#xff0c;同时可将接受的串行数据流转换为并行的数据字符供给CPU的器件。一般完成这种功能的电路&#xff0c;我们称为串行接口电路。串口通信&a…

我在SharePoint行业的从业经历(一)

&#xfeff;&#xfeff;&#xfeff;&#xfeff;大约10年前&#xff0c;我刚刚毕业的时候&#xff0c;找到了一个试用的机会。那个时候的我对软件根本没有概念。编程学的也非常少。仅仅是在系里学过一点VB和C&#xff0c;以为软件就是像QQ或者游戏之类的。我从来没想到会认识…

Linux的学习思路

自学嵌入式确实不大现实&#xff08;当然也不是说没有这个可能&#xff09;&#xff0c;毕竟嵌入式难度也是比较大的。 嵌入式的应用主要是几个方向&#xff0c; 一是系统开发&#xff1a;侧重开发环境搭建、内核原理、交叉编译等&#xff1b; 二是嵌入式Linux应用开发&#xf…

tinycore php,tinycore中文支持

这两天在弄tinycore&#xff0c;想用它来搭个小系统出来。下载最新的CorePlus-current.iso 4.5.2&#xff0c;用开源的usb的安装工具core2usb-1.6.exe将它安装到u盘&#xff0c;然后接上台式机上&#xff0c;开机从u盘启动&#xff0c;一切顺利。好&#xff0c;开始搞起&#…

javascript权威指南--学习笔记

-一、JavaScript基本数据类型 1、数字--Number类 2、字符串--String类 3、布尔--Boolean类 4、函数Function 5、对象Object 6、数组Array 7、null 8、undefined 备注&#xff1a; 当一个未定义的值用于布尔环境&#xff0c;他就会转为false&#xff0c;用于数字环境就会转为…

支持 dotnet 6 的 dnSpy 神器版本

官方的 dnSpy 在 2021 时&#xff0c;由于某些吃瓜的原因 wtfsck 将 dnSpy 给 Archived 掉&#xff0c;在大佬被哄好之前&#xff0c;预计是不再更新。最新官方版本对 dotnet 6 的支持较弱&#xff0c;对于很多 dotnet 6 应用都无法成功调试&#xff0c;附加调试上去将会让应用…

cmd命令

mstsc 开启远程连接services.msc 开启服务sc delete 服务名称 删除服务telnet 106.75.97.193 查看端口是否占用netstat -a 查看端口监听状态

Robot Framework 教程 (3) - Resource及关键字 的使用

From:http://www.cnblogs.com/buaawp/p/4754399.html Robot Framework 教程 (3) - Resource及关键字 的使用 在进行软件自动化测试时&#xff0c;我们设计并编写好一个测试脚本的业务逻辑之后&#xff0c;需要将其中的业务数据提取为变量&#xff0c;并对业务逻辑进行封装。在后…

mysql中的操作指令,MySQL中常用指令操作的介绍(代码示例)

本篇文章给大家带来的内容是关于MySQL中常用指令操作的介绍(代码示例)&#xff0c;有一定的参考价值&#xff0c;有需要的朋友可以参考一下&#xff0c;希望对你有所帮助。l 创建数据库&#xff1a;CREATE DATABASE table_name;l 删除数据库&#xff1a;DROP DATABASE table_na…

mt19937 -- 高质量随机数

优点:产生速度快, 周期大 用法: #include<bits/stdc.h> using namespace std;int main() {mt19937 mt_rand(time(0));cout << mt_rand() << endl;return 0; } 转载于:https://www.cnblogs.com/widsom/p/9935561.html

使用 AutoMapper 自动在多个数据模型间进行转换

访问数据库、IPC 通信、业务模型、视图模型……对于同一个业务的同一种数据&#xff0c;经常会使用多种数据模型工作在不同的代码模块中。这时它们之间的互相转换便是大量的重复代码了。使用 AutoMapper 便可以很方便地在不同的模型之间进行转换而减少编写太多的转换代码&#…