791 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			791 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
 | 
						|
<!DOCTYPE HTML>
 | 
						|
<html lang="" >
 | 
						|
    <head>
 | 
						|
        <meta charset="UTF-8">
 | 
						|
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
 | 
						|
        <title>Change Log · GORM Guide</title>
 | 
						|
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 | 
						|
        <meta name="description" content="">
 | 
						|
        <meta name="generator" content="GitBook 3.2.2">
 | 
						|
        
 | 
						|
        
 | 
						|
        
 | 
						|
    
 | 
						|
    <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">
 | 
						|
    <div class="book-summary">
 | 
						|
        
 | 
						|
            
 | 
						|
<div id="book-search-input" role="search">
 | 
						|
    <input type="text" placeholder="Type to search" />
 | 
						|
</div>
 | 
						|
 | 
						|
            
 | 
						|
                <nav role="navigation">
 | 
						|
                
 | 
						|
 | 
						|
 | 
						|
<div class="book-summary">
 | 
						|
    
 | 
						|
    <nav role="navigation">
 | 
						|
        <ul class="summary">
 | 
						|
            
 | 
						|
            
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.1" data-path="./">
 | 
						|
            
 | 
						|
                <a href="./">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.1.</b>
 | 
						|
                    
 | 
						|
                    Getting Started with GORM
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.2" data-path="database.html">
 | 
						|
            
 | 
						|
                <a href="database.html">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.2.</b>
 | 
						|
                    
 | 
						|
                    Database
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
            <ul class="articles">
 | 
						|
                
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.2.1" data-path="database.html">
 | 
						|
            
 | 
						|
                <a href="database.html#connecting-to-a-database">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.2.1.</b>
 | 
						|
                    
 | 
						|
                    Database Connection
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.2.2" data-path="database.html">
 | 
						|
            
 | 
						|
                <a href="database.html#migration">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.2.2.</b>
 | 
						|
                    
 | 
						|
                    Migration
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
 | 
						|
            </ul>
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3" data-path="models.html">
 | 
						|
            
 | 
						|
                <a href="models.html">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.</b>
 | 
						|
                    
 | 
						|
                    Models
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
            <ul class="articles">
 | 
						|
                
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.1" data-path="models.html">
 | 
						|
            
 | 
						|
                <a href="models.html#model-definition">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.1.</b>
 | 
						|
                    
 | 
						|
                    Model Definition
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.2" data-path="models.html">
 | 
						|
            
 | 
						|
                <a href="models.html#conventions">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.2.</b>
 | 
						|
                    
 | 
						|
                    Conventions & Overriding
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.3" data-path="associations.html">
 | 
						|
            
 | 
						|
                <a href="associations.html">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.3.</b>
 | 
						|
                    
 | 
						|
                    Associations
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
            <ul class="articles">
 | 
						|
                
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.3.1" data-path="associations.html">
 | 
						|
            
 | 
						|
                <a href="associations.html#belongs-to">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.3.1.</b>
 | 
						|
                    
 | 
						|
                    Belongs To
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.3.2" data-path="associations.html">
 | 
						|
            
 | 
						|
                <a href="associations.html#has-one">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.3.2.</b>
 | 
						|
                    
 | 
						|
                    Has One
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.3.3" data-path="associations.html">
 | 
						|
            
 | 
						|
                <a href="associations.html#has-many">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.3.3.</b>
 | 
						|
                    
 | 
						|
                    Has Many
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.3.4" data-path="associations.html">
 | 
						|
            
 | 
						|
                <a href="associations.html#many-to-many">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.3.4.</b>
 | 
						|
                    
 | 
						|
                    Many To Many
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.3.5" data-path="associations.html">
 | 
						|
            
 | 
						|
                <a href="associations.html#polymorphism">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.3.5.</b>
 | 
						|
                    
 | 
						|
                    Polymorphism
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.3.3.6" data-path="associations.html">
 | 
						|
            
 | 
						|
                <a href="associations.html#association-mode">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.3.3.6.</b>
 | 
						|
                    
 | 
						|
                    Association Mode
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
 | 
						|
            </ul>
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
 | 
						|
            </ul>
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.4" data-path="crud.html">
 | 
						|
            
 | 
						|
                <a href="crud.html">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.4.</b>
 | 
						|
                    
 | 
						|
                    CRUD: Reading and Writing Data
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
            <ul class="articles">
 | 
						|
                
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.4.1" data-path="crud.html">
 | 
						|
            
 | 
						|
                <a href="crud.html#create">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.4.1.</b>
 | 
						|
                    
 | 
						|
                    Create
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.4.2" data-path="crud.html">
 | 
						|
            
 | 
						|
                <a href="crud.html#query">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.4.2.</b>
 | 
						|
                    
 | 
						|
                    Query
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.4.3" data-path="crud.html">
 | 
						|
            
 | 
						|
                <a href="crud.html#preloading-eager-loading">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.4.3.</b>
 | 
						|
                    
 | 
						|
                    Preloading (Eager Loading)
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.4.4" data-path="crud.html">
 | 
						|
            
 | 
						|
                <a href="crud.html#update">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.4.4.</b>
 | 
						|
                    
 | 
						|
                    Update
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.4.5" data-path="crud.html">
 | 
						|
            
 | 
						|
                <a href="crud.html#delete">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.4.5.</b>
 | 
						|
                    
 | 
						|
                    Delete / Soft Delete
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.4.6" data-path="crud.html">
 | 
						|
            
 | 
						|
                <a href="crud.html#associations">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.4.6.</b>
 | 
						|
                    
 | 
						|
                    Associations
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
 | 
						|
            </ul>
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.5" data-path="callbacks.html">
 | 
						|
            
 | 
						|
                <a href="callbacks.html">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.5.</b>
 | 
						|
                    
 | 
						|
                    Callbacks
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.6" data-path="advanced.html">
 | 
						|
            
 | 
						|
                <a href="advanced.html">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.6.</b>
 | 
						|
                    
 | 
						|
                    Advanced Usage
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
            <ul class="articles">
 | 
						|
                
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.6.1" data-path="advanced.html">
 | 
						|
            
 | 
						|
                <a href="advanced.html#error-handling">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.6.1.</b>
 | 
						|
                    
 | 
						|
                    Error Handling
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.6.2" data-path="advanced.html">
 | 
						|
            
 | 
						|
                <a href="advanced.html#transactions">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.6.2.</b>
 | 
						|
                    
 | 
						|
                    Transactions
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.6.3" data-path="advanced.html">
 | 
						|
            
 | 
						|
                <a href="advanced.html#sql-builder">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.6.3.</b>
 | 
						|
                    
 | 
						|
                    Raw SQL & SQL Builder
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.6.4" data-path="advanced.html">
 | 
						|
            
 | 
						|
                <a href="advanced.html#generic-database-interface-sqldb">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.6.4.</b>
 | 
						|
                    
 | 
						|
                    Generic database interface sql.DB
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.6.5" data-path="advanced.html">
 | 
						|
            
 | 
						|
                <a href="advanced.html#compose-primary-key">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.6.5.</b>
 | 
						|
                    
 | 
						|
                    Composite Primary Key
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.6.6" data-path="advanced.html">
 | 
						|
            
 | 
						|
                <a href="advanced.html#logger">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.6.6.</b>
 | 
						|
                    
 | 
						|
                    Overriding Logger
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
 | 
						|
            </ul>
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.7" data-path="development.html">
 | 
						|
            
 | 
						|
                <a href="development.html">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.7.</b>
 | 
						|
                    
 | 
						|
                    Development
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
            <ul class="articles">
 | 
						|
                
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.7.1" data-path="development.html">
 | 
						|
            
 | 
						|
                <a href="development.html#architecture">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.7.1.</b>
 | 
						|
                    
 | 
						|
                    Architecture
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter " data-level="1.7.2" data-path="development.html">
 | 
						|
            
 | 
						|
                <a href="development.html#write-plugins">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.7.2.</b>
 | 
						|
                    
 | 
						|
                    Write Plugins
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
 | 
						|
            </ul>
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
        <li class="chapter active" data-level="1.8" data-path="changelog.html">
 | 
						|
            
 | 
						|
                <a href="changelog.html">
 | 
						|
            
 | 
						|
                    
 | 
						|
                        <b>1.8.</b>
 | 
						|
                    
 | 
						|
                    Change Log
 | 
						|
            
 | 
						|
                </a>
 | 
						|
            
 | 
						|
 | 
						|
            
 | 
						|
        </li>
 | 
						|
    
 | 
						|
 | 
						|
            <li class="divider"></li>
 | 
						|
            
 | 
						|
        </ul>
 | 
						|
    </nav>
 | 
						|
    
 | 
						|
</div>
 | 
						|
 | 
						|
 | 
						|
                </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">
 | 
						|
                            
 | 
						|
<div id="book-search-results">
 | 
						|
    <div class="search-noresults">
 | 
						|
    
 | 
						|
                                <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-literal">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 it will check <code>deleted_at</code> less than <code>0001-01-02</code> also to exclude blank time, like:</p>
 | 
						|
<p><code>SELECT * FROM users WHERE deleted_at IS NULL OR deleted_at <= '0001-01-02'</code></p>
 | 
						|
<p>But it is not necessary if you are using type <code>*time.Time</code> for your model's <code>DeletedAt</code>, which has been used by <code>gorm.Model</code>, so below SQl is enough</p>
 | 
						|
<p><code>SELECT * FROM users WHERE deleted_at IS NULL</code></p>
 | 
						|
<p>So if you are using <code>gorm.Model</code>, then you are good, nothing need to be change, just make sure all records having blank time for <code>deleted_at</code> set to <code>NULL</code>, sample migrate script:</p>
 | 
						|
</li>
 | 
						|
</ul>
 | 
						|
<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>
 | 
						|
<ul>
 | 
						|
<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>, which looks ugly, 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 default column name with tag, like <code>gorm:"column:s_k_u"</code>, or alert your database's column name according to new logic</p>
 | 
						|
</li>
 | 
						|
<li><p>Error <code>RecordNotFound</code> has been renamed to <code>ErrRecordNotFound</code></p>
 | 
						|
</li>
 | 
						|
<li><p><code>mssql</code> driver has been moved out from default drivers, import it with <code>import _ "github.com/jinzhu/gorm/dialects/mssql"</code></p>
 | 
						|
</li>
 | 
						|
<li><p><code>Hstore</code> has been moved to package <code>github.com/jinzhu/gorm/dialects/postgres</code></p>
 | 
						|
</li>
 | 
						|
</ul>
 | 
						|
 | 
						|
                                
 | 
						|
                                </section>
 | 
						|
                            
 | 
						|
    </div>
 | 
						|
    <div class="search-results">
 | 
						|
        <div class="has-results">
 | 
						|
            
 | 
						|
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
 | 
						|
            <ul class="search-results-list"></ul>
 | 
						|
            
 | 
						|
        </div>
 | 
						|
        <div class="no-results">
 | 
						|
            
 | 
						|
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
 | 
						|
            
 | 
						|
        </div>
 | 
						|
    </div>
 | 
						|
</div>
 | 
						|
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                
 | 
						|
            </div>
 | 
						|
 | 
						|
            
 | 
						|
                
 | 
						|
                <a href="development.html#write-plugins" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Write Plugins">
 | 
						|
                    <i class="fa fa-angle-left"></i>
 | 
						|
                </a>
 | 
						|
                
 | 
						|
                
 | 
						|
            
 | 
						|
        
 | 
						|
    </div>
 | 
						|
 | 
						|
    <script>
 | 
						|
        var gitbook = gitbook || [];
 | 
						|
        gitbook.push(function() {
 | 
						|
            gitbook.page.hasChanged({"page":{"title":"Change Log","level":"1.8","depth":1,"previous":{"title":"Write Plugins","level":"1.7.2","depth":2,"anchor":"#write-plugins","path":"development.md","ref":"development.md#write-plugins","articles":[]},"dir":"ltr"},"config":{"plugins":["github","edit-link"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"fontsettings":{"theme":"night","family":"sans","size":2},"github":{"url":"https://github.com/jinzhu/gorm"},"edit-link":{"label":"Edit This Page","base":"https://github.com/jinzhu/gorm/edit/gh-pages/documents/"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"GORM Guide","gitbook":"*"},"file":{"path":"changelog.md","mtime":"2017-01-02T12:58:30.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-01-02T13:55:56.479Z"},"basePath":".","book":{"language":""}});
 | 
						|
        });
 | 
						|
    </script>
 | 
						|
</div>
 | 
						|
 | 
						|
        
 | 
						|
    <script src="gitbook/gitbook.js"></script>
 | 
						|
    <script src="gitbook/theme.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-search/search-engine.js"></script>
 | 
						|
        
 | 
						|
    
 | 
						|
        
 | 
						|
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
 | 
						|
        
 | 
						|
    
 | 
						|
        
 | 
						|
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
 | 
						|
        
 | 
						|
    
 | 
						|
        
 | 
						|
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
 | 
						|
        
 | 
						|
    
 | 
						|
        
 | 
						|
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
 | 
						|
        
 | 
						|
    
 | 
						|
        
 | 
						|
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
 | 
						|
        
 | 
						|
    
 | 
						|
 | 
						|
    </body>
 | 
						|
</html>
 | 
						|
 |