You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
332 B
19 lines
332 B
package serialization
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
type Writable interface {
|
|
WriteToFile(string) error
|
|
}
|
|
|
|
type Serialized []byte
|
|
|
|
// WriteToFile writes serialized data to specified file.
|
|
//
|
|
// Make sure to use .json extension for best compatibility.
|
|
func (s Serialized) WriteToFile(path string) error {
|
|
return os.WriteFile(path, s, 0600)
|
|
}
|