<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>规范 on 艺术码农的小栈</title><link>https://itart.cn/tags/standard.html</link><description>Recent content in 规范 on 艺术码农的小栈</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Sun, 21 Aug 2022 09:22:41 +0800</lastBuildDate><atom:link href="https://itart.cn/tags/standard/index.xml" rel="self" type="application/rss+xml"/><item><title>Yaml配置入门</title><link>https://itart.cn/blogs/2022/standard/yaml-intro.html</link><pubDate>Sun, 21 Aug 2022 09:22:41 +0800</pubDate><guid>https://itart.cn/blogs/2022/standard/yaml-intro.html</guid><description>&lt;h2 id="简介"&gt;简介&lt;/h2&gt;
&lt;p&gt;配置文件建议使用yaml格式，功能比较强大，且灵活发，目前广泛使用（k8s、springboot）&lt;/p&gt;
&lt;p&gt;application.yml： 以yml为后缀的文件为YAML文件。&lt;/p&gt;</description></item><item><title>Go http handler统一响应&amp;异常处理</title><link>https://itart.cn/blogs/2021/go/go-http-response-uniform-handler.html</link><pubDate>Mon, 22 Nov 2021 13:01:46 +0800</pubDate><guid>https://itart.cn/blogs/2021/go/go-http-response-uniform-handler.html</guid><description>&lt;h2 id="背景"&gt;背景&lt;/h2&gt;
&lt;p&gt;Golang的在开发web时，会对不同的请求实现不同的hander方法，通常是实现http.HandlerFunc接口：&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// The HandlerFunc type is an adapter to allow the use of&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// ordinary functions as HTTP handlers. If f is a function&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// with the appropriate signature, HandlerFunc(f) is a&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Handler that calls f.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;type&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;HandlerFunc&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;func&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;ResponseWriter&lt;/span&gt;, &lt;span style="color:#f92672"&gt;*&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;Request&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;例如：&lt;/p&gt;</description></item><item><title>Go推荐命名规范</title><link>https://itart.cn/blogs/2021/go/go-recommend-names.html</link><pubDate>Wed, 17 Nov 2021 22:16:45 +0800</pubDate><guid>https://itart.cn/blogs/2021/go/go-recommend-names.html</guid><description>&lt;h2 id="go命名规范"&gt;Go命名规范&lt;/h2&gt;
&lt;p&gt;好的命名可以提高代码的可读性，特点：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;统一 ： 容易猜想，约定俗成&lt;/li&gt;
&lt;li&gt;简短 ：容易书写（Go尤为强调）&lt;/li&gt;
&lt;li&gt;准确 ：准确表达意思&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="核心准则"&gt;核心准则&lt;/h2&gt;
&lt;p&gt;声明的地方和使用的地方离得越远，名字就建议越详细，相对也会越长，同样上下文没提供有效的描述也是如此。&lt;/p&gt;</description></item><item><title>Vue开发规范</title><link>https://itart.cn/blogs/2020/standard/vue-specification.html</link><pubDate>Sun, 01 Mar 2020 18:48:09 +0800</pubDate><guid>https://itart.cn/blogs/2020/standard/vue-specification.html</guid><description>&lt;h2 id="命名规范"&gt;命名规范&lt;/h2&gt;
&lt;p&gt;文件夹/文件名/自定义组件标签和属性命名使用kebab-case风格&lt;/p&gt;
&lt;p&gt;JavaScript中的变量名使用camelCase风格，除了组件名定义和import时使用PascalCase风格&lt;/p&gt;</description></item><item><title>数据库设计规范</title><link>https://itart.cn/blogs/2020/standard/database-specification.html</link><pubDate>Sun, 01 Mar 2020 18:48:09 +0800</pubDate><guid>https://itart.cn/blogs/2020/standard/database-specification.html</guid><description>&lt;h2 id="设计规范"&gt;设计规范&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;【推荐】字段允许&lt;strong&gt;适当冗余&lt;/strong&gt;，以提高查询性能，但必须考虑数据一致。冗余字段应遵循:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;不是频繁修改的字段。&lt;/li&gt;
&lt;li&gt;不是 varchar 超长字段，更不能是 text 字段&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Good&lt;/strong&gt;: “产品名”适当冗余，可以减少和产品表的关联
**Bad **: &amp;ldquo;产品修改时间&amp;rdquo;，产品描述，产品组件数&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;【推荐】数据库主键不使用自增（手动插入ID容易冲突，系统集成切割、合表自增都会有问题）&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;【推荐】字段尽量设置为 NOT NULL， 为字段提供默认值（节省空间，索引，count问题，条件需要考虑null还是空白等）&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Good&lt;/strong&gt;：字符型的默认值为一个空字符值串’’，数值型默认值为数值 0&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bad&lt;/strong&gt;：status允许为null或空白&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>