Skip to content

Commit 196e08a

Browse files
authored
Merge pull request #2004 from The127/unify-receiver-types
Unify receiver types
2 parents b3b05a2 + 9dfeefc commit 196e08a

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

cmd/generate-database/db/mapping.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func (f *Field) Stmt() string {
295295

296296
// IsScalar returns true if the field is a scalar column value from a joined table.
297297
func (f *Field) IsScalar() bool {
298-
return f.JoinConfig() != ""
298+
return f.joinConfig() != ""
299299
}
300300

301301
// IsIndirect returns true if the field is a scalar column value from a joined
@@ -318,7 +318,7 @@ func (f *Field) Column() string {
318318

319319
column := lex.SnakeCase(f.Name)
320320

321-
join := f.JoinConfig()
321+
join := f.joinConfig()
322322
if join != "" {
323323
column = fmt.Sprintf("%s AS %s", join, column)
324324
}
@@ -353,7 +353,7 @@ func (f *Field) SelectColumn(mapping *Mapping, primaryTable string) (string, err
353353
}
354354

355355
var column string
356-
join := f.JoinConfig()
356+
join := f.joinConfig()
357357
if join != "" {
358358
column = join
359359
} else {
@@ -419,7 +419,7 @@ func (f *Field) JoinClause(mapping *Mapping, table string) (string, error) {
419419
return "", fmt.Errorf("Cannot join and leftjoin at the same time for field %q of struct %q", f.Name, mapping.Name)
420420
}
421421

422-
join := f.JoinConfig()
422+
join := f.joinConfig()
423423
if f.Config.Get("leftjoin") != "" {
424424
joinTemplate = strings.ReplaceAll(joinTemplate, "JOIN", "LEFT JOIN")
425425
}
@@ -484,7 +484,7 @@ func (f *Field) InsertColumn(mapping *Mapping, primaryTable string, defs map[*as
484484
}
485485
}
486486

487-
table, _, ok := strings.Cut(f.JoinConfig(), ".")
487+
table, _, ok := strings.Cut(f.joinConfig(), ".")
488488
if !ok {
489489
return "", "", fmt.Errorf("'join' tag of field %q of struct %q must be of form <table>.<column>", f.Name, mapping.Name)
490490
}
@@ -523,7 +523,7 @@ func (f *Field) InsertColumn(mapping *Mapping, primaryTable string, defs map[*as
523523
return column, value, nil
524524
}
525525

526-
func (f Field) JoinConfig() string {
526+
func (f *Field) joinConfig() string {
527527
join := f.Config.Get("join")
528528
if join == "" {
529529
join = f.Config.Get("leftjoin")
@@ -533,7 +533,7 @@ func (f Field) JoinConfig() string {
533533
}
534534

535535
// SQLConfig returns the table and column specified by the 'sql' config key, if present.
536-
func (f Field) SQLConfig() (string, string, error) {
536+
func (f *Field) SQLConfig() (string, string, error) {
537537
where := f.Config.Get("sql")
538538

539539
if where == "" {
@@ -549,8 +549,8 @@ func (f Field) SQLConfig() (string, string, error) {
549549
}
550550

551551
// ScalarTableColumn gets the table and column from the join configuration.
552-
func (f Field) ScalarTableColumn() (string, string, error) {
553-
join := f.JoinConfig()
552+
func (f *Field) ScalarTableColumn() (string, string, error) {
553+
join := f.joinConfig()
554554

555555
if join == "" {
556556
return "", "", fmt.Errorf("Missing join config for field %q", f.Name)

cmd/generate-database/db/stmt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func (s *Stmt) namesBy(buf *file.Buffer) error {
311311
}
312312

313313
joins = append(joins, join)
314-
column = field.JoinConfig()
314+
column = field.joinConfig()
315315
} else {
316316
column = mapping.FieldColumnName(field.Name, tableName)
317317
}
@@ -403,7 +403,7 @@ func (s *Stmt) id(buf *file.Buffer) error {
403403

404404
var column string
405405
if field.IsScalar() {
406-
column = field.JoinConfig()
406+
column = field.joinConfig()
407407

408408
join, err := field.JoinClause(mapping, table)
409409
joins = append(joins, join)

internal/server/dns/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (d dnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
9191
}
9292

9393
// Check access.
94-
if !d.isAllowed(zone.Info, ip, r.IsTsig(), w.TsigStatus() == nil) {
94+
if !isAllowed(zone.Info, ip, r.IsTsig(), w.TsigStatus() == nil) {
9595
// On auth failure, return NXDOMAIN to avoid information leaks.
9696
m := &dns.Msg{}
9797
m.SetRcode(r, dns.RcodeNameError)
@@ -138,7 +138,7 @@ func (d dnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
138138
}
139139
}
140140

141-
func (d *dnsHandler) isAllowed(zone api.NetworkZone, ip string, tsig *dns.TSIG, tsigStatus bool) bool {
141+
func isAllowed(zone api.NetworkZone, ip string, tsig *dns.TSIG, tsigStatus bool) bool {
142142
type peer struct {
143143
address string
144144
key string

internal/server/storage/drivers/driver_zfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (d *zfs) Info() Info {
161161
// ensureInitialDatasets creates missing initial datasets or configures existing ones with current policy.
162162
// Accepts warnOnExistingPolicyApplyError argument, if true will warn rather than fail if applying current policy
163163
// to an existing dataset fails.
164-
func (d zfs) ensureInitialDatasets(warnOnExistingPolicyApplyError bool) error {
164+
func (d *zfs) ensureInitialDatasets(warnOnExistingPolicyApplyError bool) error {
165165
// Build the list of datasets to query.
166166
datasets := []string{d.config["zfs.pool_name"]}
167167
for _, entry := range d.initialDatasets() {

shared/api/instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ func (c *Instance) Writable() InstancePut {
276276
// IsActive checks whether the instance state indicates the instance is active.
277277
//
278278
// API extension: instances.
279-
func (c Instance) IsActive() bool {
279+
func (c *Instance) IsActive() bool {
280280
switch c.StatusCode {
281281
case Stopped:
282282
return false

0 commit comments

Comments
 (0)