![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
github.com/dagger/graphql-go-tools
Like apollo-tools for graphql-go
MakeExecutableSchema
Currently supports:
Planned:
Limitations:
TypeDefs
with schema language can be extended and have custom directives applied.func main() {
schema, err := tools.MakeExecutableSchema(tools.ExecutableSchema{
TypeDefs: `
directive @description(value: String!) on FIELD_DEFINITION
type Foo {
id: ID!
name: String!
description: String
}
type Query {
foo(id: ID!): Foo @description(value: "bazqux")
}`,
Resolvers: tools.ResolverMap{
"Query": &tools.ObjectResolver{
Fields: tools.FieldResolveMap{
"foo": &tools.FieldResolver{
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
// lookup data
return foo, nil
}
},
},
},
},
SchemaDirectives: tools.SchemaDirectiveVisitorMap{
"description": &tools.SchemaDirectiveVisitor{
VisitFieldDefinition: func(field *graphql.Field, args map[string]interface{}) {
resolveFunc := field.Resolve
field.Resolve = func(p graphql.ResolveParams) (interface{}, error) {
result, err := resolveFunc(p)
if err != nil {
return result, err
}
data := result.(map[string]interface{})
data["description"] = args["value"]
return data, nil
}
},
},
},
})
if err != nil {
log.Fatalf("Failed to build schema, error: %v", err)
}
params := graphql.Params{
Schema: schema,
RequestString: `
query GetFoo {
foo(id: "5cffbf1ccecefcfff659cea8") {
description
}
}`,
}
r := graphql.Do(params)
if r.HasErrors() {
log.Fatalf("failed to execute graphql operation, errors: %+v", r.Errors)
}
rJSON, _ := json.Marshal(r)
fmt.Printf("%s \n", rJSON)
}
Modified graphql-go/handler
with updated GraphiQL and Playground
See handler package
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.