gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/bitable/v1/model_ext.go (about) 1 /* 2 * MIT License 3 * 4 * Copyright (c) 2022 Lark Technologies Pte. Ltd. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 * 8 * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 */ 12 13 package larkbitable 14 15 func (a *AppTableRecord) StringField(key string) *string { 16 if a == nil || a.Fields == nil { 17 return nil 18 } 19 20 v := a.Fields[key] 21 if v == nil { 22 return nil 23 } 24 25 if v, ok := v.(string); ok { 26 return &v 27 } 28 29 return nil 30 } 31 32 func (a *AppTableRecord) ListStringField(key string) []string { 33 if a == nil || a.Fields == nil { 34 return nil 35 } 36 if v, ok := a.Fields[key].([]string); ok { 37 return v 38 } 39 40 return nil 41 } 42 43 func (a *AppTableRecord) BoolField(key string) *bool { 44 if a == nil || a.Fields == nil { 45 return nil 46 } 47 if v, ok := a.Fields[key].(bool); ok { 48 return &v 49 } 50 51 return nil 52 } 53 54 func (a *AppTableRecord) ListUrlField(key string) []Url { 55 if v, ok := a.Fields[key].([]Url); ok { 56 return v 57 } 58 59 return nil 60 } 61 62 func (a *AppTableRecord) ListPersonField(key string) []Person { 63 if v, ok := a.Fields[key].([]Person); ok { 64 return v 65 } 66 67 return nil 68 } 69 70 func (a *AppTableRecord) ListAttachmentField(key string) []Attachment { 71 if v, ok := a.Fields[key].([]Attachment); ok { 72 return v 73 } 74 return nil 75 }