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.pswp.cn/news/281712.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/281712.shtml
英文地址,請注明出處:http://en.pswp.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 便可以很方便地在不同的模型之間進行轉換而減少編寫太多的轉換代碼&#…