Skip to content

Commit

Permalink
writerType -> WriterType
Browse files Browse the repository at this point in the history
  • Loading branch information
pebbe committed Oct 8, 2020
1 parent aac3635 commit c8ab6b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions alpinocorpus/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ Example usage:
Opening a corpus for reading:
reader, error := alpinocorpus.NewReader(filename)
reader, err := alpinocorpus.NewReader(filename)
defer reader.Close() // to free resources
if error != nil {
log.Fatalln(error)
if err != nil {
log.Fatalln(err)
}
Getting all entries from the corpus:
entries, error := reader.GetAll()
if error != nil {
log.Fatalln(error)
entries, err := reader.GetAll(alpinocorpus.NaturalOrder)
if err != nil {
log.Fatalln(err)
}
Or, getting al entries that match some query:
entries, error := reader.Query("//node[@root=\"fiets\"]")
if error != nil {
log.Fatalln(error)
entries, err := reader.Query("//node[@root=\"fiets\"]")
if err != nil {
log.Fatalln(err)
}
And then, this:
Expand Down
10 changes: 5 additions & 5 deletions alpinocorpus/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ type Writer struct {
mu sync.Mutex
}

type writerType int
type WriterType int

const (
Compact writerType = iota
Compact WriterType = iota
Dbxml
)

var (
wType = map[writerType]string{
wType = map[WriterType]string{
Compact: "COMPACT_CORPUS_WRITER",
Dbxml: "DBXML_CORPUS_WRITER"}
)
Expand Down Expand Up @@ -68,7 +68,7 @@ func NewWriter(filename string, overwrite bool) (*Writer, error) {
// NewWriterType() opens an Alpino corpus for writing.
// The type of corpus is specified in the third argument.
// Currently, the only valid types are Compact and Dbxml.
func NewWriterType(filename string, overwrite bool, writertype writerType) (*Writer, error) {
func NewWriterType(filename string, overwrite bool, writertype WriterType) (*Writer, error) {
cs := C.CString(filename)
defer C.free(unsafe.Pointer(cs))
ct := C.CString(wType[writertype])
Expand Down Expand Up @@ -138,7 +138,7 @@ func (w *Writer) isopen() error {

// Check whether a particular writer type is available.
// Currently, the only valid types are Compact and Dbxml.
func WriterAvailable(writertype writerType) bool {
func WriterAvailable(writertype WriterType) bool {
ct := C.CString(wType[writertype])
defer C.free(unsafe.Pointer(ct))
if int(C.alpinocorpus_writer_available(ct)) == 0 {
Expand Down

0 comments on commit c8ab6b4

Please sign in to comment.