ManagedIrbis ported to Go language
Currently supported Go 1.12 on 64-bit Windows and Linux
package main
import "./src/irbis"
func main () {
// Connect to the server
connection := irbis.NewConnection()
connection.Host = "localhost"
connection.Username = "librarian"
connection.Password = "secret"
if !connection.Connect() {
println("Can't connect")
connection.FailOnError()
}
// Will be disconnected at exit
defer connection.Disconnect()
// General server information
println("Server version:", connection.ServerVersion)
println("Interval:", connection.Interval)
// Proposed client settings from INI-file
ini := connection.Ini
dbnnamecat := ini.GetValue("Main", "DBNNAMECAT", "???")
println("DBNNAMECAT:", dbnnamecat)
// Search for books written by Byron
found := connection.Search("\"A=Byron, George$\"")
println("Records found:", len(found))
for _, mfn := range found {
// Read the record
record := connection.ReadRecord(mfn)
// Get field/subfield value
title := record.FSM(200, 'a')
println("Title:", title)
// Formatting (at the server)
description := connection.FormatMfn("@brief", mfn)
println("Description:", description)
}
}