// Set defining parameters of field in a single call func (fd FieldDefinition) Set( name string, fType FieldType, width, precision int, justify Justification, ) { cName := C.CString(name) defer C.free(unsafe.Pointer(cName)) C.OGR_Fld_Set( fd.cval, cName, C.OGRFieldType(fType), C.int(width), C.int(precision), C.OGRJustification(justify), ) }
// Fetch human readable name for the field type func (ft FieldType) Name() string { name := C.OGR_GetFieldTypeName(C.OGRFieldType(ft)) return C.GoString(name) }
// Set the type of this field func (fd FieldDefinition) SetType(fType FieldType) { C.OGR_Fld_SetType(fd.cval, C.OGRFieldType(fType)) }
// Create a new field definition func CreateFieldDefinition(name string, fieldType FieldType) FieldDefinition { cName := C.CString(name) defer C.free(unsafe.Pointer(cName)) fieldDef := C.OGR_Fld_Create(cName, C.OGRFieldType(fieldType)) return FieldDefinition{fieldDef} }