Documentation ¶
Overview ¶
Package database writes MMDBs to disk.
Index ¶
Constants ¶
View Source
const ZeroMD5 = "00000000000000000000000000000000"
ZeroMD5 is the default value provided as an MD5 hash for a non-existent database.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalFileWriter ¶
type LocalFileWriter struct {
// contains filtered or unexported fields
}
LocalFileWriter is a database.Writer that stores the database to the local file system.
func NewLocalFileWriter ¶
func NewLocalFileWriter( databaseDir string, preserveFileTime bool, verbose bool, ) (*LocalFileWriter, error)
NewLocalFileWriter create a LocalFileWriter.
func (*LocalFileWriter) GetHash ¶
func (w *LocalFileWriter) GetHash(editionID string) (string, error)
GetHash returns the hash of the current database file.
func (*LocalFileWriter) Write ¶
func (w *LocalFileWriter) Write( editionID string, reader io.ReadCloser, newMD5 string, lastModified time.Time, ) (err error)
Write writes the database to a file. The database content will be read from reader.
type ReadResult ¶
type ReadResult struct { EditionID string `json:"edition_id"` OldHash string `json:"old_hash"` NewHash string `json:"new_hash"` ModifiedAt time.Time `json:"modified_at"` CheckedAt time.Time `json:"checked_at"` }
ReadResult is the struct returned by a Reader's Get method.
func (ReadResult) MarshalJSON ¶
func (r ReadResult) MarshalJSON() ([]byte, error)
MarshalJSON is a custom json marshaler that strips out zero time fields.
func (*ReadResult) UnmarshalJSON ¶
func (r *ReadResult) UnmarshalJSON(data []byte) error
UnmarshalJSON is a custom json unmarshaler that converts timestamps to go time fields.
Click to show internal directories.
Click to hide internal directories.