Skip to content

Commit 12601df

Browse files
committed
some method renaming & more documentation
1 parent 2c48ac6 commit 12601df

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

dialect/dialect.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type Dialect interface {
2323
FieldAsColumn(field *schema.Field) string
2424
TruncateDDL(tableName string, force bool) []string
2525
CreateTableSettings() string
26-
InsertHasReturningPhrase() bool
2726
ShowTables() string
2827

2928
// ReplacePlaceholders alters a query string by replacing the '?' placeholders with the appropriate
@@ -33,8 +32,14 @@ type Dialect interface {
3332
Placeholders(n int) string
3433
// HasNumberedPlaceholders returns true for dialects such as PostgreSQL that use numbered placeholders.
3534
HasNumberedPlaceholders() bool
36-
// HasLastInsertId returns true for dialects such as MySQL that return a last-insert ID after each INSERT.
35+
// HasLastInsertId returns true for dialects such as MySQL that return a last-insert ID after each
36+
// INSERT. This allows the corresponding feature of the database/sql API to work.
37+
// It is the inverse of InsertHasReturningPhrase.
3738
HasLastInsertId() bool
39+
// InsertHasReturningPhrase returns true for dialects such as Postgres that use a RETURNING phrase to
40+
// obtain the last-insert ID after each INSERT.
41+
// It is the inverse of HasLastInsertId.
42+
InsertHasReturningPhrase() bool
3843
}
3944

4045
//-------------------------------------------------------------------------------------------------

schema/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type Index struct {
4545
Fields FieldList
4646
}
4747

48-
func (t *TableDescription) HasLastInsertId() bool {
48+
func (t *TableDescription) HasIntegerPrimaryKey() bool {
4949
return t.Primary != nil && t.Primary.Type.Base.IsInteger()
5050
}
5151

0 commit comments

Comments
 (0)