Documentation ¶
Index ¶
- Constants
- func B64ToRes(str string) (engine.Res, error)
- func GetGID(group string) (int, error)
- func GetUID(username string) (int, error)
- func LangFieldNameToStructFieldName(kind string) (map[string]string, error)
- func LangFieldNameToStructType(kind string) (map[string]*types.Type, error)
- func LowerStructFieldNameToFieldName(res engine.Res) (map[string]string, error)
- func ResToB64(res engine.Res) (string, error)
- func StructKindToFieldNameTypeMap(kind string) (map[string]*types.Type, error)
- func StructTagToFieldName(res engine.Res) (map[string]string, error)
Constants ¶
const ( // StructTag is the key we use in struct field names for key mapping. StructTag = "lang" // DBusInterface is the dbus interface that contains genereal methods. DBusInterface = "org.freedesktop.DBus" // DBusAddMatch is the dbus method to receive a subset of dbus broadcast // signals. DBusAddMatch = DBusInterface + ".AddMatch" // DBusRemoveMatch is the dbus method to remove a previously defined // AddMatch rule. DBusRemoveMatch = DBusInterface + ".RemoveMatch" )
Variables ¶
This section is empty.
Functions ¶
func GetGID ¶
GetGID returns the GID of a group. It supports a GID or a group name. Caller should first check group is not empty. It will return an error if it can't lookup the GID or group name.
func GetUID ¶
GetUID returns the UID of an user. It supports an UID or an username. Caller should first check user is not empty. It will return an error if it can't lookup the UID or username.
func LangFieldNameToStructFieldName ¶
LangFieldNameToStructFieldName returns the mapping from lang (AST) field names to field name as used in the struct. The logic here is a bit strange; if the resource has struct tags, then it uses those, otherwise it falls back to using the lower case versions of things. It might be clever to combine the two so that tagged fields are used as such, and others are used in lowercase, but this is currently not implemented. TODO: should this behaviour be changed?
func LangFieldNameToStructType ¶
LangFieldNameToStructType returns the mapping from lang (AST) field names, and the expected type in our type system for each.
func LowerStructFieldNameToFieldName ¶
LowerStructFieldNameToFieldName returns a mapping from the lower case version of each field name to the actual field name. It only returns public fields. It returns an error if it finds a collision.
func StructKindToFieldNameTypeMap ¶
StructKindToFieldNameTypeMap returns a map from field name to expected type in the lang type system.
Types ¶
This section is empty.