github.com/safing/portbase@v0.19.5/database/hookbase.go (about)

     1  package database
     2  
     3  import (
     4  	"github.com/safing/portbase/database/record"
     5  )
     6  
     7  // HookBase implements the Hook interface and provides dummy functions to reduce boilerplate.
     8  type HookBase struct{}
     9  
    10  // UsesPreGet implements the Hook interface and returns false.
    11  func (b *HookBase) UsesPreGet() bool {
    12  	return false
    13  }
    14  
    15  // UsesPostGet implements the Hook interface and returns false.
    16  func (b *HookBase) UsesPostGet() bool {
    17  	return false
    18  }
    19  
    20  // UsesPrePut implements the Hook interface and returns false.
    21  func (b *HookBase) UsesPrePut() bool {
    22  	return false
    23  }
    24  
    25  // PreGet implements the Hook interface.
    26  func (b *HookBase) PreGet(dbKey string) error {
    27  	return nil
    28  }
    29  
    30  // PostGet implements the Hook interface.
    31  func (b *HookBase) PostGet(r record.Record) (record.Record, error) {
    32  	return r, nil
    33  }
    34  
    35  // PrePut implements the Hook interface.
    36  func (b *HookBase) PrePut(r record.Record) (record.Record, error) {
    37  	return r, nil
    38  }