Update documents
This commit is contained in:
parent
42e845f0b4
commit
8f36cec4ae
@ -71,7 +71,7 @@ The database handle returned from db.Begin() should be used for all oper">
|
||||
data-chapter-title="Advanced Usage"
|
||||
data-filepath="advanced.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 21:51:55 GMT+0800 (CST)"
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
@ -549,6 +549,21 @@ The database handle returned from db.Begin() should be used for all oper">
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
||||
data-chapter-title="Associations"
|
||||
data-filepath="associations.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 21:51:55 GMT+0800 (CST)"
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
@ -548,6 +548,21 @@
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ If any callback returns an error, gorm will stop future operations and rollback
|
||||
data-chapter-title="Callbacks"
|
||||
data-filepath="callbacks.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 21:51:55 GMT+0800 (CST)"
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
@ -549,6 +549,21 @@ If any callback returns an error, gorm will stop future operations and rollback
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
695
changelog.html
Normal file
695
changelog.html
Normal file
@ -0,0 +1,695 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<title>Change Log · GORM Guide</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="description" content="gorm.Open return type *gorm.DB instead of gorm.DB">
|
||||
<meta name="generator" content="GitBook 3.0.0-pre.1">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="development.html" />
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="book"
|
||||
data-level="7"
|
||||
data-chapter-title="Change Log"
|
||||
data-filepath="changelog.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
<div class="book-summary">
|
||||
|
||||
<nav role="navigation">
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="0" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
Getting Started with GORM
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1" data-path="database.html">
|
||||
|
||||
<a href="database.html">
|
||||
|
||||
|
||||
<b>1.</b>
|
||||
|
||||
Database
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="database.html">
|
||||
|
||||
<a href="database.html#connecting-to-a-database">
|
||||
|
||||
|
||||
<b>1.1.</b>
|
||||
|
||||
Database Connection
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="database.html">
|
||||
|
||||
<a href="database.html#migration">
|
||||
|
||||
|
||||
<b>1.2.</b>
|
||||
|
||||
Migration
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2" data-path="models.html">
|
||||
|
||||
<a href="models.html">
|
||||
|
||||
|
||||
<b>2.</b>
|
||||
|
||||
Models
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.1" data-path="models.html">
|
||||
|
||||
<a href="models.html#model-defination">
|
||||
|
||||
|
||||
<b>2.1.</b>
|
||||
|
||||
Model Defination
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.2" data-path="models.html">
|
||||
|
||||
<a href="models.html#conventions-overriding-conventions">
|
||||
|
||||
|
||||
<b>2.2.</b>
|
||||
|
||||
Naming Conventions & Overriding
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3" data-path="associations.html">
|
||||
|
||||
<a href="associations.html">
|
||||
|
||||
|
||||
<b>2.3.</b>
|
||||
|
||||
Associations
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="2.3.1" data-path="associations.html">
|
||||
|
||||
<a href="associations.html#belongs-to">
|
||||
|
||||
|
||||
<b>2.3.1.</b>
|
||||
|
||||
Belongs To
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3.2" data-path="associations.html">
|
||||
|
||||
<a href="associations.html#has-one">
|
||||
|
||||
|
||||
<b>2.3.2.</b>
|
||||
|
||||
Has One
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3.3" data-path="associations.html">
|
||||
|
||||
<a href="associations.html#has-many">
|
||||
|
||||
|
||||
<b>2.3.3.</b>
|
||||
|
||||
Has Many
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3.4" data-path="associations.html">
|
||||
|
||||
<a href="associations.html#many-to-many">
|
||||
|
||||
|
||||
<b>2.3.4.</b>
|
||||
|
||||
Many To Many
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3.5" data-path="associations.html">
|
||||
|
||||
<a href="associations.html#polymorphism">
|
||||
|
||||
|
||||
<b>2.3.5.</b>
|
||||
|
||||
Polymorphism
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="2.3.6" data-path="associations.html">
|
||||
|
||||
<a href="associations.html#association-mode">
|
||||
|
||||
|
||||
<b>2.3.6.</b>
|
||||
|
||||
Association Mode
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3" data-path="curd.html">
|
||||
|
||||
<a href="curd.html">
|
||||
|
||||
|
||||
<b>3.</b>
|
||||
|
||||
CRUD: Reading and Writing Data
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="3.1" data-path="curd.html">
|
||||
|
||||
<a href="curd.html#create">
|
||||
|
||||
|
||||
<b>3.1.</b>
|
||||
|
||||
Create
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.2" data-path="curd.html">
|
||||
|
||||
<a href="curd.html#query">
|
||||
|
||||
|
||||
<b>3.2.</b>
|
||||
|
||||
Query
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.3" data-path="curd.html">
|
||||
|
||||
<a href="curd.html#preloading">
|
||||
|
||||
|
||||
<b>3.3.</b>
|
||||
|
||||
Preloading (Eager Loading)
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.4" data-path="curd.html">
|
||||
|
||||
<a href="curd.html#update">
|
||||
|
||||
|
||||
<b>3.4.</b>
|
||||
|
||||
Update
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="3.5" data-path="curd.html">
|
||||
|
||||
<a href="curd.html#delete">
|
||||
|
||||
|
||||
<b>3.5.</b>
|
||||
|
||||
Delete / Soft Delete
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="4" data-path="callbacks.html">
|
||||
|
||||
<a href="callbacks.html">
|
||||
|
||||
|
||||
<b>4.</b>
|
||||
|
||||
Callbacks
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="5" data-path="advanced.html">
|
||||
|
||||
<a href="advanced.html">
|
||||
|
||||
|
||||
<b>5.</b>
|
||||
|
||||
Advanced Usage
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="5.1" data-path="advanced.html">
|
||||
|
||||
<a href="advanced.html#error-handling">
|
||||
|
||||
|
||||
<b>5.1.</b>
|
||||
|
||||
Error Handling
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="5.2" data-path="advanced.html">
|
||||
|
||||
<a href="advanced.html#transactions">
|
||||
|
||||
|
||||
<b>5.2.</b>
|
||||
|
||||
Transactions
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="5.3" data-path="advanced.html">
|
||||
|
||||
<a href="advanced.html#sql-builder">
|
||||
|
||||
|
||||
<b>5.3.</b>
|
||||
|
||||
Raw SQL & SQL Builder
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="5.4" data-path="advanced.html">
|
||||
|
||||
<a href="advanced.html#compose-primary-key">
|
||||
|
||||
|
||||
<b>5.4.</b>
|
||||
|
||||
Composite Primary Key
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="5.5" data-path="advanced.html">
|
||||
|
||||
<a href="advanced.html#logger">
|
||||
|
||||
|
||||
<b>5.5.</b>
|
||||
|
||||
Overriding Logger
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="6" data-path="development.html">
|
||||
|
||||
<a href="development.html">
|
||||
|
||||
|
||||
<b>6.</b>
|
||||
|
||||
Development
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="6.1" data-path="development.html">
|
||||
|
||||
<a href="development.html#callbacks">
|
||||
|
||||
|
||||
<b>6.1.</b>
|
||||
|
||||
Write Plugins
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href="" >Change Log</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="change-log">Change Log</h1>
|
||||
<h2 id="v10">v1.0</h2>
|
||||
<h4 id="breaking-changes">Breaking Changes</h4>
|
||||
<ul>
|
||||
<li><p><strong><code>gorm.Open</code> return type <code>*gorm.DB</code> instead of <code>gorm.DB</code></strong></p>
|
||||
</li>
|
||||
<li><p><strong>Updating will only update changed fields</strong></p>
|
||||
<p>Most applications won't be affected, only when you are changing updating values in callbacks like <code>BeforeSave</code>, <code>BeforeUpdate</code>, you should use <code>scope.SetColumn</code> then, for example:</p>
|
||||
<pre><code class="lang-go"><span class="hljs-keyword">func</span> (user *User) BeforeUpdate(scope *gorm.Scope) {
|
||||
<span class="hljs-keyword">if</span> pw, err := bcrypt.GenerateFromPassword(user.Password, <span class="hljs-number">0</span>); err == <span class="hljs-constant">nil</span> {
|
||||
scope.SetColumn(<span class="hljs-string">"EncryptedPassword"</span>, pw)
|
||||
<span class="hljs-comment">// user.EncryptedPassword = pw // doesn't work, won't including EncryptedPassword field when updating</span>
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</li>
|
||||
<li><p><strong>Soft delete's default querying scope will only check <code>deleted_at IS NULL</code></strong></p>
|
||||
<p>Before <code>db.Find(&user)</code> will generate querying SQL if user has <code>DeletedAt</code> field</p>
|
||||
<p><code>SELECT * FROM users WHERE deleted_at IS NULL OR deleted_at <= '0001-01-02'</code></p>
|
||||
<p>Now won't include blank time check <code><= '0001-01-02</code> anymore, will generat SQL like:</p>
|
||||
<p><code>SELECT * FROM users WHERE deleted_at IS NULL</code></p>
|
||||
<p>So your application's <code>DeletedAt</code> field should not use <code>time.Time</code> as data type, need to use pointer <code>*time.Time</code> or something like <code>NullTime</code>.
|
||||
If you are using <code>gorm.Model</code>, then you are good, nothing need to be change, just make sure all records using blank time for <code>deleted_at</code> has been set to NULL, sample migration script:</p>
|
||||
<pre><code class="lang-go"><span class="hljs-keyword">import</span> (
|
||||
<span class="hljs-string">"github.com/jinzhu/now"</span>
|
||||
)
|
||||
|
||||
<span class="hljs-keyword">func</span> main() {
|
||||
<span class="hljs-keyword">var</span> models = []<span class="hljs-keyword">interface</span>{}{&User{}, &Image{}}
|
||||
<span class="hljs-keyword">for</span> _, model := <span class="hljs-keyword">range</span> models {
|
||||
db.Unscoped().Model(model).Where(<span class="hljs-string">"deleted_at < ?"</span>, now.MustParse(<span class="hljs-string">"0001-01-02"</span>)).Update(<span class="hljs-string">"deleted_at"</span>, gorm.Expr(<span class="hljs-string">"NULL"</span>))
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</li>
|
||||
<li><p><strong>New ToDBName logic</strong></p>
|
||||
<p>Before when GORM convert Struct, Field's name to db name, only those common initialisms from <a href="https://github.com/golang/lint/blob/master/lint.go#L702" target="_blank">golint</a> like <code>HTTP</code>, <code>URI</code> are special handled.</p>
|
||||
<p>So field <code>HTTP</code>'s db name will be <code>http</code> not <code>h_t_t_p</code>, but some other initialisms like <code>SKU</code> that not in golint, it's db name will be <code>s_k_u</code>, this release fixed this, any upper case initialisms should be converted correctly.</p>
|
||||
<p>If your applications using some upper case initialisms which doesn't exist in <a href="https://github.com/golang/lint/blob/master/lint.go#L702" target="_blank">golint</a>, you need to overwrite generated column name with tag, like <code>sql:"column:s_k_u"</code>, or alert your database's column name according to new logic</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="development.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Write Plugins">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="gitbook/app.js"></script>
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-edit-link/plugin.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-anker-enable/anker.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="gitbook/gitbook-plugin-fontsettings/buttons.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
require(["gitbook"], function(gitbook) {
|
||||
gitbook.start({"fontsettings":{"theme":"night","size":2,"family":"sans"},"toc":{"addClass":true,"className":"toc"},"github":{"url":"https://github.com/jinzhu/gorm"},"edit-link":{"base":"https://github.com/jinzhu/gorm/edit/gh-pages","label":"Edit This Page"},"anker-enable":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"all":["facebook","google","instapaper","twitter","weibo"],"facebook":true,"google":false,"instapaper":false,"twitter":true,"vk":false,"weibo":false},"theme-default":{"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"}}});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
17
curd.html
17
curd.html
@ -70,7 +70,7 @@
|
||||
data-chapter-title="CRUD: Reading and Writing Data"
|
||||
data-filepath="curd.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 21:51:55 GMT+0800 (CST)"
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
@ -548,6 +548,21 @@
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
||||
data-chapter-title="Database"
|
||||
data-filepath="database.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 21:51:55 GMT+0800 (CST)"
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
@ -548,6 +548,21 @@
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
||||
data-chapter-title="Development"
|
||||
data-filepath="development.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 21:51:55 GMT+0800 (CST)"
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
@ -548,6 +548,21 @@
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
25
index.html
25
index.html
@ -68,7 +68,7 @@
|
||||
data-chapter-title="Getting Started with GORM"
|
||||
data-filepath="README.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 21:51:55 GMT+0800 (CST)"
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
@ -546,6 +546,21 @@
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
@ -588,20 +603,22 @@
|
||||
<li>Full-Featured ORM (almost)</li>
|
||||
<li>Chainable API</li>
|
||||
<li>Auto Migrations</li>
|
||||
<li>Relations (Has One, Has Many, Belongs To, Many To Many, <a href="#polymorphism">Polymorphism</a>)</li>
|
||||
<li>Relations (Has One, Has Many, Belongs To, Many To Many, Polymorphism)</li>
|
||||
<li>Callbacks (Before/After Create/Save/Update/Delete/Find)</li>
|
||||
<li>Preloading (eager loading)</li>
|
||||
<li>Transactions</li>
|
||||
<li>Embed Anonymous Struct</li>
|
||||
<li>Soft Deletes</li>
|
||||
<li>Customizable Logger</li>
|
||||
<li>Iteration Support via <a href="#row--rows">Rows</a></li>
|
||||
<li>Iteration Support via Rows</li>
|
||||
<li>Every feature comes with tests</li>
|
||||
<li>Developer Friendly</li>
|
||||
</ul>
|
||||
<h2 id="install">Install</h2>
|
||||
<pre><code>go get -u github.com/jinzhu/gorm
|
||||
</code></pre><h2 id="basic-usage">Basic Usage</h2>
|
||||
</code></pre><h2 id="upgrading">Upgrading</h2>
|
||||
<p><a href="http://jinzhu.github.io/gorm/changelog.html" target="_blank">Change Log</a></p>
|
||||
<h2 id="basic-usage">Basic Usage</h2>
|
||||
<pre><code class="lang-go"><span class="hljs-keyword">type</span> Product <span class="hljs-keyword">struct</span> {
|
||||
gorm.Model
|
||||
Code <span class="hljs-typename">string</span>
|
||||
|
17
models.html
17
models.html
@ -70,7 +70,7 @@
|
||||
data-chapter-title="Models"
|
||||
data-filepath="models.md"
|
||||
data-basepath=""
|
||||
data-revision="Mon Feb 29 2016 21:51:55 GMT+0800 (CST)"
|
||||
data-revision="Mon Feb 29 2016 22:57:46 GMT+0800 (CST)"
|
||||
data-innerlanguage="">
|
||||
|
||||
|
||||
@ -548,6 +548,21 @@
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="7" data-path="changelog.html">
|
||||
|
||||
<a href="changelog.html">
|
||||
|
||||
|
||||
<b>7.</b>
|
||||
|
||||
Change Log
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user